$ g++ bug.cc -O2
$ ./a.out 
Segmentation fault
$ g++ bug.cc -O2 -fno-tree-salias
$ ./a.out 
$ 

testcase:
------------------------------------------------------------------------------
#include <sstream>

void foo ()
{
  std::stringbuf b;
}

int main()
{
  foo ();
  return 0;
}
------------------------------------------------------------------------------

-- 
           Summary: [4.1 regression] structure aliasing causes wrong code
           Product: gcc
           Version: 4.1.0
            Status: UNCONFIRMED
          Keywords: wrong-code
          Severity: critical
          Priority: P2
         Component: tree-optimization
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: belyshev at depni dot sinp dot msu dot ru
                CC: gcc-bugs at gcc dot gnu dot org
  GCC host triplet: x86_64-unknown-linux-gnu
GCC target triplet: x86_64-unknown-linux-gnu


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

Reply via email to