This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/67748] New: generate wrong code with -02 in 32bits only


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67748

            Bug ID: 67748
           Summary: generate wrong code with -02 in 32bits only
           Product: gcc
           Version: 5.2.0
            Status: UNCONFIRMED
          Severity: major
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: lepere.Renaud at yahoo dot com
  Target Milestone: ---

Created attachment 36409
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=36409&action=edit
code that crash at execution

The following code bug.cpp crash at execution it seems that the stack is
corrupted (the return adress is bad).

It happens only in 32bits with -O2 and above. 
I tried to make the code as small as possible but I did not succeed to remove
the dependency to boost (BOOST_CHECK_CLOSE function).

Note also that using a normal function rather than an internal lambda "fixes"
the problem. 

What can I do to help ? 


Some more infos on how i compile the code, and about my compiler

c:\Mingw32\bin\g++  -ftemplate-depth-128 -O3 -finline-functions -Wno-inline
-Wall -m32 -Wno-deprecated -Wno-unused-function -Wno-unused-local-typedefs
-ftemplate-depth=1000 -std=gnu++0x -DBOOST_SYSTEM_NO_DEPRECATED
-DBOOST_TEST_DYN_LINK -DNDEBUG  -I".."
-I"c:\Users\Renaud\nest\external\boost_1_57_0" -c -o bug.o "bug.cpp"
c:\Mingw32\bin\g++ -L"c:\Users\Renaud\nest\external\boost_1_57_0\stage\lib"
-Wl,-R -Wl,"c:\Users\Renaud\nest\external\boost_1_57_0\stage\lib"  -o bug.exe
-Wl,--start-group "bug.o"  -Wl,-Bstatic  -Wl,-Bdynamic
-lboost_unit_test_framework-mgw52-mt-1_57-r32 -Wl,--end-group -m32 
bug.exe

 -fno-strict-aliasing -fwrapv  has no effects, and -Wall -Wextra leads to
warnings on autoptr (deprecated) and some warnings on ununsed variables
(because I reduced the problem).

c:\mingw32\bin>gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=c:/mingw32/bin/../libexec/gcc/i686-w64-mingw32/5.2.0/lto-wrapper.exe
Target: i686-w64-mingw32
Configured with: ../../../src/gcc-5.2.0/configure --host=i686-w64-mingw32
--build=i686-w64-mingw32 --target=i686-w64-mingw32 --prefix=/mingw32
--with-sysroot=/c/mingw520/i686-520-posix-sjlj-rt_v4-rev0/mingw32
--with-gxx-include-dir=/mingw32/i686-w64-mingw32/include/c++ --enable-shared
--enable-static --enable-targets=all --enable-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 --enable-sjlj-exceptions
--disable-isl-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-32=i686 --with-arch-64=nocona --with-tune-32=generic
--with-tune-64=core2 --with-libiconv --with-system-zlib
--with-gmp=/c/mingw520/prerequisites/i686-w64-mingw32-static
--with-mpfr=/c/mingw520/prerequisites/i686-w64-mingw32-static
--with-mpc=/c/mingw520/prerequisites/i686-w64-mingw32-static
--with-isl=/c/mingw520/prerequisites/i686-w64-mingw32-static
--with-pkgversion='i686-posix-sjlj-rev0, Built by MinGW-W64 project'
--with-bugurl=http://sourceforge.net/projects/mingw-w64 CFLAGS='-O2 -pipe
-I/c/mingw520/i686-520-posix-sjlj-rt_v4-rev0/mingw32/opt/include
-I/c/mingw520/prerequisites/i686-zlib-static/include
-I/c/mingw520/prerequisites/i686-w64-mingw32-static/include' CXXFLAGS='-O2
-pipe -I/c/mingw520/i686-520-posix-sjlj-rt_v4-rev0/mingw32/opt/include
-I/c/mingw520/prerequisites/i686-zlib-static/include
-I/c/mingw520/prerequisites/i686-w64-mingw32-static/include' CPPFLAGS=
LDFLAGS='-pipe -L/c/mingw520/i686-520-posix-sjlj-rt_v4-rev0/mingw32/opt/lib
-L/c/mingw520/prerequisites/i686-zlib-static/lib
-L/c/mingw520/prerequisites/i686-w64-mingw32-static/lib
-Wl,--large-address-aware'
Thread model: posix
gcc version 5.2.0 (i686-posix-sjlj-rev0, Built by MinGW-W64 project)


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]