Created attachment 1020351 [details] Preprocessed source Description of problem: I got this error while trying to compile. Version-Release number of selected component (if applicable): gcc version 4.8.3 20140911 (Red Hat 4.8.3-9) (GCC) How reproducible: Steps to Reproduce: 1. 2. 3. Actual results: Expected results: Additional info:
Reproduced with vanilla 4.8; 4.9 is fine. Bisecting...
http://gcc.gnu.org/r218205
And that commit had a follow-up: http://gcc.gnu.org/r218316
Reduced. Only -O is needed to show the ICE. class A { int _M_p; }; template < typename _Key, typename _Tp > class B { public: _Tp operator[](_Key); }; union U { long double ld; void *v; }; A a; void fn1 (U p1) { if (p1.v) *reinterpret_cast < A * >(p1.v) = a; } class C { public: C (A) { m_data.ld = 0; fn1 (m_data); } U m_data; }; class D { public: A a1; A a2; void m_fn1 () { arr[2][a1] = a2; } B < int, B < A, C > >arr; }; void fn2 () { D b; b.m_fn1 (); }
Slightly more cleaned up: // { dg-options "-O -Wno-psabi" } // { dg-do compile } struct A { int a; }; template <typename T, typename V> struct B { V operator[] (T); }; union U { long double ld; void *v; }; A a; void bar (U &x) { if (x.v) *reinterpret_cast <A *>(x.v) = a; } struct C { C (A) { c.ld = 0; bar (c); } U c; }; struct D { A d, e; void foo () { f[0][d] = e; } B <int, B <A, C> > f; }; void baz () { D d; d.foo (); }
I've backported the relevant fixes to the 4.8 branch.
(In reply to Marek Polacek from comment #7) > I've backported the relevant fixes to the 4.8 branch. You guys are awesome! Thank you. Will this be out in a patch to the compiler sometime soon?
Most likely in RHEL 7.2.
*** Bug 1222631 has been marked as a duplicate of this bug. ***
Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory, and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. https://rhn.redhat.com/errata/RHBA-2015-2080.html