public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/67748] New: generate wrong code with -02 in 32bits only
@ 2015-09-28 16:28 lepere.Renaud at yahoo dot com
  2015-09-28 16:30 ` [Bug middle-end/67748] " pinskia at gcc dot gnu.org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: lepere.Renaud at yahoo dot com @ 2015-09-28 16:28 UTC (permalink / raw)
  To: gcc-bugs

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)


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug middle-end/67748] generate wrong code with -02 in 32bits only
  2015-09-28 16:28 [Bug c++/67748] New: generate wrong code with -02 in 32bits only lepere.Renaud at yahoo dot com
@ 2015-09-28 16:30 ` pinskia at gcc dot gnu.org
  2015-09-28 16:38 ` trippels at gcc dot gnu.org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu.org @ 2015-09-28 16:30 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|c++                         |middle-end
           Severity|major                       |normal


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug middle-end/67748] generate wrong code with -02 in 32bits only
  2015-09-28 16:28 [Bug c++/67748] New: generate wrong code with -02 in 32bits only lepere.Renaud at yahoo dot com
  2015-09-28 16:30 ` [Bug middle-end/67748] " pinskia at gcc dot gnu.org
@ 2015-09-28 16:38 ` trippels at gcc dot gnu.org
  2015-09-28 17:02 ` lepere.Renaud at yahoo dot com
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: trippels at gcc dot gnu.org @ 2015-09-28 16:38 UTC (permalink / raw)
  To: gcc-bugs

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

Markus Trippelsdorf <trippels at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |trippels at gcc dot gnu.org

--- Comment #1 from Markus Trippelsdorf <trippels at gcc dot gnu.org> ---
Try to build with -fsanitize=undefined and see if anything pops up.
Do the same for -lboost_unit_test_framework.


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug middle-end/67748] generate wrong code with -02 in 32bits only
  2015-09-28 16:28 [Bug c++/67748] New: generate wrong code with -02 in 32bits only lepere.Renaud at yahoo dot com
  2015-09-28 16:30 ` [Bug middle-end/67748] " pinskia at gcc dot gnu.org
  2015-09-28 16:38 ` trippels at gcc dot gnu.org
@ 2015-09-28 17:02 ` lepere.Renaud at yahoo dot com
  2015-09-28 17:15 ` trippels at gcc dot gnu.org
  2015-09-28 17:32 ` lepere.Renaud at yahoo dot com
  4 siblings, 0 replies; 6+ messages in thread
From: lepere.Renaud at yahoo dot com @ 2015-09-28 17:02 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from renaud lepere <lepere.Renaud at yahoo dot com> ---
I tried to do it but I failed with bin/ld.exe: cannot find -lubsan 
apparently mingw64 does not yet provide it
(http://sourceforge.net/p/mingw-w64/bugs/442/)


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug middle-end/67748] generate wrong code with -02 in 32bits only
  2015-09-28 16:28 [Bug c++/67748] New: generate wrong code with -02 in 32bits only lepere.Renaud at yahoo dot com
                   ` (2 preceding siblings ...)
  2015-09-28 17:02 ` lepere.Renaud at yahoo dot com
@ 2015-09-28 17:15 ` trippels at gcc dot gnu.org
  2015-09-28 17:32 ` lepere.Renaud at yahoo dot com
  4 siblings, 0 replies; 6+ messages in thread
From: trippels at gcc dot gnu.org @ 2015-09-28 17:15 UTC (permalink / raw)
  To: gcc-bugs

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

Markus Trippelsdorf <trippels at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|---                         |INVALID

--- Comment #3 from Markus Trippelsdorf <trippels at gcc dot gnu.org> ---
Well, in this case there is nothing we could do.
It might well be a bug in the boost unit_test_framework library.

If you manage to come up with a standalone testcase, that 
doesn't depend on external libraries, please reopen.


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug middle-end/67748] generate wrong code with -02 in 32bits only
  2015-09-28 16:28 [Bug c++/67748] New: generate wrong code with -02 in 32bits only lepere.Renaud at yahoo dot com
                   ` (3 preceding siblings ...)
  2015-09-28 17:15 ` trippels at gcc dot gnu.org
@ 2015-09-28 17:32 ` lepere.Renaud at yahoo dot com
  4 siblings, 0 replies; 6+ messages in thread
From: lepere.Renaud at yahoo dot com @ 2015-09-28 17:32 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from renaud lepere <lepere.Renaud at yahoo dot com> ---
Thanks for your help. I have sent also the bug on boost mailing list to see if
someone can reproduce or reduce the problem. Not easy since for the moment it
is really in the middle..


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2015-09-28 17:32 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-09-28 16:28 [Bug c++/67748] New: generate wrong code with -02 in 32bits only lepere.Renaud at yahoo dot com
2015-09-28 16:30 ` [Bug middle-end/67748] " pinskia at gcc dot gnu.org
2015-09-28 16:38 ` trippels at gcc dot gnu.org
2015-09-28 17:02 ` lepere.Renaud at yahoo dot com
2015-09-28 17:15 ` trippels at gcc dot gnu.org
2015-09-28 17:32 ` lepere.Renaud at yahoo dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).