From Bugzilla Helper: User-Agent: Mozilla/4.77 [en] (X11; U; Linux 2.4.6 i686) Description of problem: The following program makes g++ segfault when using options -g and -O. Workaround: name the union, don't use -g or -O How reproducible: Always Steps to Reproduce: 1.Save source to bug.cc 2.g++ -g -O -c bug.cc Actual Results: g++ internal error: segfault in A &A::func2(double &) Expected Results: g++ not segfaulting ;) Additional info: struct A { int func1(); A &func2(double &); }; int A::func1() { return 0; } A & A::func2(double &arg) { union { double x; char y[8]; }; y[0] = func1(); arg = x; return *this; }
I've fixed this in http://gcc.gnu.org/ml/gcc-patches/2001-08/msg00154.html. Will be fixed in gcc-2.96-96.
*** Bug 50795 has been marked as a duplicate of this bug. ***