Skip to content

MSWin: Some tests crash if perl is built with x64 gcc-12.1 && optimize level -O2 && threads support #20024

@sisyphus

Description

@sisyphus

Description

As the title basically says, perl.exe crashes at various times during the running of the tests on MS Windows if perl was built using (a mingw-w64 port of) 64-bit gcc-12.1 && optimization level is set to -O2 && threads are supported. (32-bit gcc-12.1 is fine.)
This issue can be avoided by building perl with an earlier version of gcc, or by specifying optimization level -Os, or building perl without threads support - and all of the affected test scripts (below) will then pass normally if one (or more) of those 3 options is selected.
Debug builds are not subject to this issue - perhaps because their optimization level is not -O2 ?

Affected test scripts:
re/pat_advanced.t
t/run/switches.t
t/lib/croak.t
win32/popen.t
lib/strict.t
lib/warnings.t

The crashes occur at random, though usually in the same limited subset of files.
Other files that have been affected by this (but not tonight) are lib/charnames.t and t/op/heredoc.t. (There might be one or two other files that I've missed.)
The crashes can occur whether run inside or outside the Test::Harness.
Sometimes there can be multiple crashes within the one test file.
So far, I think it has only been re/pat_advanced.t and win32/popen.t that have reported a FAIL for these crashes.

To be clear, these crashes cause the process to halt and throw up a pop-up telling me that perl.exe has stopped working.
Once I acknowledge that pop-up, the process resumes as though nothing had happened.

I've only used 64-bit gcc-12.1 to build perl-5.36.0, perl-5.37.1 , perl-5.37.2 and all 3 have been affected by this.
For that reason, I haven't been installing and using them - preferring instead to settle for optimization level -Os for the 64 bit builds.

Perl configuration

Summary of my perl5 (revision 5 version 37 subversion 2) 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 -D_WIN32_WINNT=0x0601 -fdiagnostics-color=never -
DPERL_TEXTMODE_SCRIPTS -DMULTIPLICITY -DPERL_IMPLICIT_SYS -DUSE_PERLIO -D__USE_M
INGW_ANSI_STDIO -fwrapv -fno-strict-aliasing -mms-bitfields'
    optimize='-O2'
    cppflags='-DWIN32'
    ccversion=''
    gccversion='12.1.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:\perl-5.37.2-1210\lib\MSWin32-x64-multi-thread\CORE" -L"C:\_64\winlibs-gcc-1210\mingw64\lib" -L"C:\_64\winlibs-gcc-1210\mingw64\x86_64-w64-mingw32\lib" -L"C:\_64\winlibs-gcc-1210\mingw64\lib\gcc\x86_64-w64-mingw32\12.1.0"'
    libpth=C:\_64\winlibs-gcc-1210\mingw64\lib C:\_64\winlibs-gcc-1210\mingw64\x86_64-w64-mingw32\lib C:\_64\winlibs-gcc-1210\mingw64\lib\gcc\x86_64-w64-mingw32\12.1.0 C:\_64\msys_1210\1.0\local\lib
    libs= -lmoldname -lkernel32 -luser32 -lgdi32 -lwinspool -lcomdlg32 -ladvapi32 -lshell32 -lole32 -loleaut32 -lnetapi32 -luuid -lws2_32 -lmpr -lwinmm -lversion -lodbc32 -lodbccp32 -lcomctl32
    perllibs= -lmoldname -lkernel32 -luser32 -lgdi32 -lwinspool -lcomdlg32 -ladvapi32 -lshell32 -lole32 -loleaut32 -lnetapi32 -luuid -lws2_32 -lmpr -lwinmm -lversion -lodbc32 -lodbccp32 -lcomctl32
    libc=
    so=dll
    useshrplib=true
    libperl=libperl537.a
    gnulibc_version=''
  Dynamic Linking:
    dlsrc=dl_win32.xs
    dlext=dll
    d_dlsymun=undef
    ccdlflags=' '
    cccdlflags=' '
    lddlflags='-shared -s -L"C:\perl-5.37.2-1210\lib\MSWin32-x64-multi-thread\CORE" -L"C:\_64\winlibs-gcc-1210\mingw64\lib" -L"C:\_64\winlibs-gcc-1210\mingw64\x86_64-w64-mingw32\lib" -L"C:\_64\winlibs-gcc-1210\mingw64\lib\gcc\x86_64-w64-mingw32\12.1.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_SYS
    PERL_MALLOC_WRAP
    PERL_OP_PARENT
    PERL_PRESERVE_IVUV
    PERL_USE_SAFE_PUTENV
    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 Aug  1 2022 22:02:21
  @INC:
    .\lib
    C:/comp-1210/perl-5.37.2/lib

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