Skip to content

[Win32] "-fwrapv" disappears from ccflags with gcc version 10. #18739

@sisyphus

Description

@sisyphus

This had me a bit puzzled, but I guess that "$(GCCVER1)" geq "5" is doing string comparison, and is therefore untrue when $(GCCVER1) is in the range 10 .. 50.
(I look forward to seeing -fwrapv pop up gain when gcc-51 is released ;-)

AFAICT, the absence of -fwrapv makes no difference, and I do wonder if it was ever actually needed on Windows (or anywhere else).
Is there a simple test case for determining this ?
I'm running Windows 7. Might that make a difference ?

I've read through #13690, but found it difficult to follow, and I haven't yet managed to reproduce a case that needs that switch.

My belief is that -fwrapv is the default behaviour anyway.
If that view is correct, then I would think that the need to specify that switch must represent a bug in -fwrapv (unless, of course, it is being used to override an earlier instance of -ftrapv).

I've also built 5.33.9 (current devel, released today) without -fwrapv, using gcc-7.2.0, and all tests passed.

C:\comp-aux\perl-5.33.9\win32>..\perl -I..\lib -V:archname
archname='MSWin32-x64-multi-thread';

C:\comp-aux\perl-5.33.9\win32>..\perl -I..\lib -V:gccversion
gccversion='7.2.0';

C:\comp-aux\perl-5.33.9\win32>..\perl -I..\lib -V:ccflags
ccflags=' -DWIN32 -DWIN64  -DPERL_TEXTMODE_SCRIPTS -DPERL_IMPLICIT_CONTEXT -DPERL_IMPLICIT_SYS -DUSE_PERLIO -D__USE_MINGW_ANSI_STDIO -fno-strict-aliasing -mms-bitfields';

C:\comp-aux\perl-5.33.9\win32>..\perl -I..\lib -le "print $]"
5.033009

AFAICT perl will no longer build with gcc-4 on Windows.
With mingw-w64 port of gcc-4.9.2, I get unresolved symbols during linking when the Win32 (core) module is being built.

I guess there's really nothing wrong with specifying -fwrapv if it's not needed.
Perhaps, since perl is no longer buildable with gcc-4.3 or earlier, all we need do is hard code the -fwrapv switch permanently into the GNUmakefile ?
Or do we really want to include that switch only when it's needed ?

Here's the full 'perl -V' output of the 7.2.0 build:

C:\comp-aux\perl-5.33.9\win32>..\perl -I..\lib -V
Summary of my perl5 (revision 5 version 33 subversion 9) configuration:

  Platform:
    osname=MSWin32
    osvers=6.1.7601
    archname=MSWin32-x64-multi-thread
    uname=''
    config_args='undef'
    hint=recommended
    useposix=true
    d_sigaction=undef
    useithreads=define
    usemultiplicity=define
    use64bitint=define
    use64bitall=undef
    uselongdouble=undef
    usemymalloc=n
    default_inc_excludes_dot=define
  Compiler:
    cc='gcc'
    ccflags =' -DWIN32 -DWIN64  -DPERL_TEXTMODE_SCRIPTS -DPERL_IMPLICIT_CONTEXT
-DPERL_IMPLICIT_SYS -DUSE_PERLIO -D__USE_MINGW_ANSI_STDIO -fno-strict-aliasing -
mms-bitfields'
    optimize='-s -O2'
    cppflags='-DWIN32'
    ccversion=''
    gccversion='7.2.0'
    gccosandvers=''
    intsize=4
    longsize=4
    ptrsize=8
    doublesize=8
    byteorder=12345678
    doublekind=3
    d_longlong=define
    longlongsize=8
    d_longdbl=define
    longdblsize=16
    longdblkind=3
    ivtype='long long'
    ivsize=8
    nvtype='double'
    nvsize=8
    Off_t='long long'
    lseeksize=8
    alignbytes=8
    prototype=define
  Linker and Libraries:
    ld='g++'
    ldflags ='-s -L"C:\_64\blead-5.33.9\lib\CORE" -L"C:\_64\gcc-mingw-720\mingw6
4\lib" -L"C:\_64\gcc-mingw-720\mingw64\x86_64-w64-mingw32\lib" -L"C:\_64\gcc-min
gw-720\mingw64\lib\gcc\x86_64-w64-mingw32\7.2.0"'
    libpth=C:\_64\gcc-mingw-720\mingw64\lib C:\_64\gcc-mingw-720\mingw64\x86_64-
w64-mingw32\lib C:\_64\gcc-mingw-720\mingw64\lib\gcc\x86_64-w64-mingw32\7.2.0 C:
\_64\gcc-mingw-720\mingw64\x86_64-w64-mingw32\lib C:\_64\msys_720\1.0\local\lib
C:\_64\gcc-mingw-720\mingw64\lib\gcc\x86_64-w64-mingw32\7.2.0
    libs= -lmoldname -lkernel32 -luser32 -lgdi32 -lwinspool -lcomdlg32 -ladvapi3
2 -lshell32 -lole32 -loleaut32 -lnetapi32 -luuid -lws2_32 -lmpr -lwinmm -lversio
n -lodbc32 -lodbccp32 -lcomctl32
    perllibs= -lmoldname -lkernel32 -luser32 -lgdi32 -lwinspool -lcomdlg32 -ladv
api32 -lshell32 -lole32 -loleaut32 -lnetapi32 -luuid -lws2_32 -lmpr -lwinmm -lve
rsion -lodbc32 -lodbccp32 -lcomctl32
    libc=
    so=dll
    useshrplib=true
    libperl=libperl533.a
    gnulibc_version=''
  Dynamic Linking:
    dlsrc=dl_win32.xs
    dlext=dll
    d_dlsymun=undef
    ccdlflags=' '
    cccdlflags=' '
    lddlflags='-mdll -s -L"C:\_64\blead-5.33.9\lib\CORE" -L"C:\_64\gcc-mingw-720
\mingw64\lib" -L"C:\_64\gcc-mingw-720\mingw64\x86_64-w64-mingw32\lib" -L"C:\_64\
gcc-mingw-720\mingw64\lib\gcc\x86_64-w64-mingw32\7.2.0"'


Characteristics of this binary (from libperl):
  Compile-time options:
    HAS_TIMES
    HAVE_INTERP_INTERN
    MULTIPLICITY
    PERLIO_LAYERS
    PERL_COPY_ON_WRITE
    PERL_DONT_CREATE_GVSV
    PERL_IMPLICIT_CONTEXT
    PERL_IMPLICIT_SYS
    PERL_MALLOC_WRAP
    PERL_OP_PARENT
    PERL_PRESERVE_IVUV
    USE_64_BIT_INT
    USE_ITHREADS
    USE_LARGE_FILES
    USE_LOCALE
    USE_LOCALE_COLLATE
    USE_LOCALE_CTYPE
    USE_LOCALE_NUMERIC
    USE_LOCALE_TIME
    USE_PERLIO
    USE_PERL_ATOF
  Built under MSWin32
  Compiled at Apr 21 2021 10:22:57
  @INC:
    ..\lib
    C:/comp-aux/perl-5.33.9/lib

Cheers,
Rob

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions