Menu

#2182 gcc miscompiles conftest.c

OTHER
closed
nobody
None
Support
duplicate
Unknown
False
2014-02-04
2014-02-04
austin987
No

Using Windows 7, 32-bit. MinGW installed via mingw-get-0.6.2-beta20131004-1.

gcc -v
Using built-in specs.
COLLECT_GCC=c:\MinGW\bin\gcc.exe
COLLECT_LTO_WRAPPER=c:/mingw/bin/../libexec/gcc/mingw32/4.8.1/lto-wrapper.exe
Target: mingw32
Configured with: ../gcc-4.8.1/configure --prefix=/mingw --host=mingw32 --build=mingw32 --without-pic --enable-shared --enable-static --with-gnu-ld --enable-lto --enable-libssp --disable-multilib --enable-languages=c,c++,fortran,objc,obj-c++,ada --disable-sjlj-exceptions --with-dwarf2 --disable-win32-registry --enable-libstdcxx-debug --enable-version-specific-runtime-libs --with-gmp=/usr/src/pkg/gmp-5.1.2-1-mingw32-src/bld --with-mpc=/usr/src/pkg/mpc-1.0.1-1-mingw32-src/bld --with-mpfr= --with-system-zlib --with-gnu-as --enable-decimal-float=yes --enable-libgomp --enable-threads --with-libiconv-prefix=/mingw32 --with-libintl-prefix=/mingw --disable-bootstrap LDFLAGS=-s CFLAGS=-D_USE_32BIT_TIME_T
Thread model: win32
gcc version 4.8.1 (GCC)

The attached script will show the issue:
Compiling conftest
This should show 4: 4
This should show 4:
This should show 8: 8
This should show 8: 8

on Fedora/gcc 4.8.2, this works:
Compiling conftest
This should show 4: 4
This should show 4: 4
This should show 8: 8
This should show 8: 8

Noticed because compiling TinyCC broke. See this thread:
https://lists.nongnu.org/archive/html/tinycc-devel/2014-01/msg00091.html

1 Attachments

Discussion

  • Keith Marshall

    Keith Marshall - 2014-02-04

    Do you have a file called VERSION, (or any other case-insensitive equivalent, with upper case 'V' as the first character), in your working directory? If so, this is not strictly a GCC problem, but a duplicate of [#2062].

    Note that Earnie chose, (inappropriately IMO), to defer the solution for this until mingwrt-4.1, then lost momentum on development; this solution remains in limbo, today. As a work around, you could add a global:

    int _CRT_glob = 0;
    

    to your conftest.c, (unless you'd prefer to back-port my patch from [#2062] into your working copy of mingwrt).

     

    Related

    Issues: #2062

  • austin987

    austin987 - 2014-02-04

    Yes, that workaround works, thanks.

    I don't see the option to mark this bug as a duplicate, feel free to do so.

     
  • Keith Marshall

    Keith Marshall - 2014-02-04

    Identified as duplicate of [#2062].

     

    Related

    Issues: #2062

  • Keith Marshall

    Keith Marshall - 2014-02-04
    • status: unread --> closed
    • Resolution: none --> duplicate