develooper Front page | perl.perl5.porters | Postings from July 2016

[perl #128673] modfl() is horribly broken in MinGW-W64

Thread Previous
From:
Dan Collins
Date:
July 19, 2016 21:20
Subject:
[perl #128673] modfl() is horribly broken in MinGW-W64
Message ID:
rt-4.0.18-21161-1468963233-621.128673-75-0@perl.org
# New Ticket Created by  Dan Collins 
# Please include the string:  [perl #128673]
# in the subject line of all future correspondence about this issue. 
# <URL: https://rt.perl.org/Ticket/Display.html?id=128673 >


Hello

Found another one. In builds of blead using the MinGW-W64 toolchain for x86_64, with long doubles enabled, calls to modfl() will segfault the perl interpreter. This is not a perlbug, the below C test crashes (segfaults) in the call to modfl():

--- modftest.c

#include <tgmath.h>
#include <stdio.h>

int main() {
  long double a, b, c;
  a = 1.76;
  __mingw_printf("About to call modfl(1.76, &b)\n");
  c = modfl(a, &b);
  __mingw_printf("Alive. b = %Le, c = %Le\n", b, c);
  return 0;
}

__END__

However, as a result, ext\POSIX\t\math.t *crashes* after test 28:

../ext/POSIX/t/math.t                                            (Wstat: 65280 Tests: 28 Failed: 0)
  Non-zero exit status: 255
  Parse errors: No plan found in TAP output

This has been open upstream for about a year. There is a patch in the upstream ticket, which I have bumped. You can find the ticket here:

https://sourceforge.net/p/mingw-w64/bugs/478/

versions, for fun:

W:\buildbot\windows1\win64-mingww64-4_9_3-ld\build>gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=C:/mingw-w64/x86_64-4.9.3/mingw64/bin/../libexec/gcc/x86_64-w64-mingw32/4.9.3/lto-wrapper.exe
Target: x86_64-w64-mingw32
Configured with: ../../../src/gcc-4.9.3/configure --host=x86_64-w64-mingw32 --build=x86_64-w64-mingw32 --target=x86_64-w64-mingw32 --prefix=/mingw64 --with-sysroot=/c/mingw493/x86_64-493-posix-seh-rt_v4-rev1/mingw64 --with-gxx-include-dir=/mingw64/x86_64-w64-mingw32/include/c++ --enable-shared --enable-static --disable-multilib --enable-languages=c,c++,fortran,objc,obj-c++,lto --enable-libstdcxx-time=yes --enable-threads=posix --enable-libgomp --enable-libatomic --enable-lto --enable-graphite --enable-checking=release --enable-fully-dynamic-string --enable-version-specific-runtime-libs --disable-isl-version-check --disable-cloog-version-check --disable-libstdcxx-pch --disable-libstdcxx-debug --enable-bootstrap --disable-rpath --disable-win32-registry --disable-nls --disable-werror --disable-symvers --with-gnu-as --with-gnu-ld --with-arch=nocona --with-tune=core2 --with-libiconv --with-system-zlib --with-gmp=/c/mingw493/prerequisites/x86_64-w64-mingw32-static --with-mpfr=/c/mi
 ngw493/prerequisites/x86_64-w64-mingw32-static --with-mpc=/c/mingw493/prerequisites/x86_64-w64-mingw32-static --with-isl=/c/mingw493/prerequisites/x86_64-w64-mingw32-static --with-cloog=/c/mingw493/prerequisites/x86_64-w64-mingw32-static --enable-cloog-backend=isl --with-pkgversion='x86_64-posix-seh-rev1, Built by MinGW-W64 project' --with-bugurl=http://sourceforge.net/projects/mingw-w64 CFLAGS='-O2 -pipe -I/c/mingw493/x86_64-493-posix-seh-rt_v4-rev1/mingw64/opt/include -I/c/mingw493/prerequisites/x86_64-zlib-static/include -I/c/mingw493/prerequisites/x86_64-w64-mingw32-static/include' CXXFLAGS='-O2 -pipe -I/c/mingw493/x86_64-493-posix-seh-rt_v4-rev1/mingw64/opt/include -I/c/mingw493/prerequisites/x86_64-zlib-static/include -I/c/mingw493/prerequisites/x86_64-w64-mingw32-static/include' CPPFLAGS= LDFLAGS='-pipe -L/c/mingw493/x86_64-493-posix-seh-rt_v4-rev1/mingw64/opt/lib -L/c/mingw493/prerequisites/x86_64-zlib-static/lib -L/c/mingw493/prerequisites/x86_64-w64-mingw32-static/
 lib '
Thread model: posix
gcc version 4.9.3 (x86_64-posix-seh-rev1, Built by MinGW-W64 project)

Summary of my perl5 (revision 5 version 25 subversion 3) configuration:

  Platform:
    osname=MSWin32
    osvers=10.0
    archname=MSWin32-x64-multi-thread-ld
    uname=''
    config_args='undef'
    hint=recommended
    useposix=true
    d_sigaction=undef
    useithreads=define
    usemultiplicity=define
    use64bitint=define
    use64bitall=undef
    uselongdouble=define
    usemymalloc=n
    bincompat5005=undef
  Compiler:
    cc='gcc'
    ccflags =' -s -O2 -DWIN32 -DWIN64 -DCONSERVATIVE  -DPERL_TEXTMODE_SCRIPTS -DPERL_IMPLICIT_CONTEXT -DPERL_IMPLICIT_SYS -D__USE_MINGW_ANSI_STDIO -fwrapv -fno-strict-aliasing -mms-bitfields'
    optimize='-s -O2'
    cppflags='-DWIN32'
    ccversion=''
    gccversion='4.9.3'
    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='long double'
    nvsize=16
    Off_t='long long'
    lseeksize=8
    alignbytes=8
    prototype=define
  Linker and Libraries:
    ld='g++'
    ldflags ='-s -L"c:\perl\lib\CORE" -L"C:\mingw-w64\x86_64-4.9.3\mingw64\lib"'
    libpth=C:\mingw-w64\x86_64-4.9.3\mingw64\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=libperl525.a
    gnulibc_version=''
  Dynamic Linking:
    dlsrc=dl_win32.xs
    dlext=dll
    d_dlsymun=undef
    ccdlflags=' '
    cccdlflags=' '
    lddlflags='-mdll -s -L"c:\perl\lib\CORE" -L"C:\mingw-w64\x86_64-4.9.3\mingw64\lib"'


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_HASH_FUNC_ONE_AT_A_TIME_HARD
    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_LONG_DOUBLE
    USE_PERLIO
    USE_PERL_ATOF
  Built under MSWin32
  Compiled at Jul 19 2016 16:34:24
  @INC:
    W:/buildbot/windows1/win64-mingww64-4_9_3-ld/build/lib
    .


-- 
Respectfully,
Dan Collins


Thread Previous


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About