Bug 1217267
| Summary: | internal compiler error: in fold_convert_loc, at fold-const.c:1922 | ||||||
|---|---|---|---|---|---|---|---|
| Product: | Red Hat Enterprise Linux 7 | Reporter: | Robert Thornthwaite <robert.thornthwaite> | ||||
| Component: | gcc | Assignee: | Jakub Jelinek <jakub> | ||||
| Status: | CLOSED ERRATA | QA Contact: | Miroslav Franc <mfranc> | ||||
| Severity: | unspecified | Docs Contact: | |||||
| Priority: | unspecified | ||||||
| Version: | 7.1 | CC: | mcermak, mfranc, mpolacek, ohudlick | ||||
| Target Milestone: | rc | ||||||
| Target Release: | --- | ||||||
| Hardware: | Unspecified | ||||||
| OS: | Unspecified | ||||||
| Whiteboard: | |||||||
| Fixed In Version: | gcc-4.8.5-1.el7 | Doc Type: | Bug Fix | ||||
| Doc Text: |
Previously, GCC could generate wrong code from code that passed a union data type with a signed and an unsigned integer between two functions as a parameter. The compiler could incorrectly insert the __builtin_unreachable call into a codepath in the program that was, in fact, reachable, which resulted in a crash. This bug in the IPA inline analysis has been fixed, and GCC now generates correct code also in the described scenario.
|
Story Points: | --- | ||||
| Clone Of: | Environment: | ||||||
| Last Closed: | 2015-11-19 12:22:45 UTC | Type: | Bug | ||||
| Regression: | --- | Mount Type: | --- | ||||
| Documentation: | --- | CRM: | |||||
| Verified Versions: | Category: | --- | |||||
| oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |||||
| Cloudforms Team: | --- | Target Upstream Version: | |||||
| Embargoed: | |||||||
| Attachments: |
|
||||||
Reproduced with vanilla 4.8; 4.9 is fine. Bisecting... 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 |
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: