Menu

#1675 Static variable lost when linking dynamically

closed
nobody
gcc-4.7.0 (11)
2012-10-19
2012-10-19
mme
No

When compiling and running the attached testcase, Factory<T>::factory_size() returns 0, since the methods pointer is NULL, although it is assigned properly in Factory<T>::register_method(). The expected result is a size of 1.

When linking the library statically, the result is correct, so i'm setting the category to binutils. Don't know whether it is related to gcc though.

The same testcase compiled with g++ on Linux or VC++ on Windows XP/Windows 7 runs as expected.

The system used is MinGW on Windows XP/Windows 7.

Es werden eingebaute Spezifikationen verwendet.
COLLECT_GCC=C:\MinGW\bin\gcc.exe
COLLECT_LTO_WRAPPER=c:/mingw/bin/../libexec/gcc/mingw32/4.7.0/lto-wrapper.exe
Ziel: mingw32
Konfiguriert mit: ../gcc-4.7.0/configure --enable-languages=c,c++,ada,fortran,objc,obj-c++ --disable-sjlj-exceptions --with-dwarf2 --enable-shared --enable-libgomp --disable-win32-registry --enable-libstdcxx-debug --disable-build-poststage1-with-cxx --enable-version-specific-runtime-libs --build=mingw32 --prefix=/mingw
Thread-Modell: win32
gcc-Version 4.7.0 (GCC)

GNU ld (GNU Binutils) 2.22

MINGW32_NT-5.1 hostname 1.0.17(0.48/3/2) 2011-04-24 23:39 i686 Msys

The same error happens with gcc-4.6.2.

Discussion

  • mme

    mme - 2012-10-19

    testcase

     
  • Earnie Boyd

    Earnie Boyd - 2012-10-19
    • labels: 103947 --> gcc-4.7.0
    • status: open --> closed
     
  • Earnie Boyd

    Earnie Boyd - 2012-10-19

    You should report your test case to GCC bug list. We currently do not have any GCC maintainers to do it for you.