public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/59163] New: program compiled with g++ -O3 segfaults
@ 2013-11-17 22:44 donnyjward at gmail dot com
  2013-11-18 10:49 ` [Bug rtl-optimization/59163] " redi at gcc dot gnu.org
                   ` (23 more replies)
  0 siblings, 24 replies; 25+ messages in thread
From: donnyjward at gmail dot com @ 2013-11-17 22:44 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59163

            Bug ID: 59163
           Summary: program compiled with g++ -O3 segfaults
           Product: gcc
           Version: 4.8.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: donnyjward at gmail dot com

Created attachment 31232
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=31232&action=edit
Stripped preprocessed C++ source.

The attached test case crashes (segmentation fault) when run. It is a
preprocessed file where I stripped just about everything from <algorithm>
except std::for_each.

gcc -v:

~/src $ gcc -v
Using built-in specs.
COLLECT_GCC=/usr/bin/gcc
COLLECT_LTO_WRAPPER=/app/gcc/4.8.2/libexec/gcc/x86_64-unknown-linux-gnu/4.8.2/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: ./gcc-4.8.2/configure --prefix=/app/gcc/4.8.2
--enable-languages=c,c++ --disable-multilib
Thread model: posix
gcc version 4.8.2 (GCC) 
~/src $ 


The complete command line that triggers the bug:
g++ -O3 -std=c++11 -Wall -Wextra bug2.ii

...then run the output program to see the segmentation fault

I tried building with:
g++ -O3 -std=c++11 -fno-strict-aliasing -fwrapv
-fno-aggressive-loop-optimizations -Wall -Wextra bug2.ii

...and the same crash occurs.

The compiler outputs no messages (no warnings errors etc).

The program runs without crashing if compiled with -O0, -O1, -O2, or -Os.

I compiled with the latest version of clang++ bundled with Mac's XCode, trying
each optimization level and the program runs fine. Same with the latest version
of MSVC (Visual Studio 2013).


The gdb segfault and backtrace:
Program received signal SIGSEGV, Segmentation fault.
0x00000000004007a7 in Quaternion::slerp(Quaternion const&, Quaternion const&)
() at bug2.ii:82
82    {
(gdb) bt
#0  0x00000000004007a7 in Quaternion::slerp(Quaternion const&, Quaternion
const&) () at bug2.ii:82
#1  0x0000000000400475 in main () at bug2.ii:97
(gdb) 


Extra observations:
If I comment out "int parent" in the struct definition so that the struct
becomes

  struct Joint
  {
    //int parent;
    Quaternion orient;
  };

the program no longer segfaults when compiled/run.


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

end of thread, other threads:[~2013-12-10  7:50 UTC | newest]

Thread overview: 25+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-11-17 22:44 [Bug c++/59163] New: program compiled with g++ -O3 segfaults donnyjward at gmail dot com
2013-11-18 10:49 ` [Bug rtl-optimization/59163] " redi at gcc dot gnu.org
2013-11-18 11:41 ` [Bug rtl-optimization/59163] [4.8/4.9 Regression] " rguenth at gcc dot gnu.org
2013-11-21 14:49 ` [Bug tree-optimization/59163] " rguenth at gcc dot gnu.org
2013-11-29  8:16 ` jakub at gcc dot gnu.org
2013-11-29  8:52 ` jakub at gcc dot gnu.org
2013-11-29  9:22 ` [Bug target/59163] " rguenth at gcc dot gnu.org
2013-11-29 10:34 ` jakub at gcc dot gnu.org
2013-11-29 12:57 ` ubizjak at gmail dot com
2013-11-29 13:43 ` ubizjak at gmail dot com
2013-11-29 14:38 ` jakub at gcc dot gnu.org
2013-11-29 16:28 ` ubizjak at gmail dot com
2013-11-29 16:39 ` ubizjak at gmail dot com
2013-11-29 16:57 ` jakub at gcc dot gnu.org
2013-11-29 18:14 ` ubizjak at gmail dot com
2013-11-29 19:56 ` ubizjak at gmail dot com
2013-11-29 20:28 ` jakub at gcc dot gnu.org
2013-11-29 20:54 ` jakub at gcc dot gnu.org
2013-11-30  7:14 ` jakub at gcc dot gnu.org
2013-11-30  9:59 ` ubizjak at gmail dot com
2013-12-04 11:11 ` jakub at gcc dot gnu.org
2013-12-04 11:12 ` jakub at gcc dot gnu.org
2013-12-04 15:51 ` jakub at gcc dot gnu.org
2013-12-04 15:55 ` jakub at gcc dot gnu.org
2013-12-10  7:50 ` jakub at gcc dot gnu.org

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).