https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66424
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|RESOLVED |NEW
Last reconfirmed| |2015-06-05
CC| |vmakarov at gcc dot gnu.org
Resolution|INVALID |---
Target Milestone|--- |5.2
Summary|wrong code at -O2 and -O3 |[5/6 Regression] wrong code
|on x86_64-linux-gnu in |at -O2 and -O3 on
|32-bit mode |x86_64-linux-gnu in 32-bit
| |mode
Ever confirmed|0 |1
--- Comment #5 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Apparently it reproduces also with following, which doesn't have at least this
kind of undefined behavior in it. Started with r217588, thus most likely a
register allocation issue.
int a, b, c, d, e[2], f, l, m, n, o;
long long g = 1, j;
static unsigned int h;
static int i, k;
void
fn1 (long long p)
{
int q = p;
f = 1 ^ e[f ^ (q & 1)];
}
static void
fn2 (long long p)
{
f = 1 ^ e[(f ^ 1) & 1];
fn1 (p >> 1 & 1);
fn1 (p >> 32 & 1);
}
void
fn3 (int p)
{
g |= j = p;
}
int
main ()
{
e[0] = 1;
char p = l;
h = --g;
i = o = c;
m = d ? 1 / d : 0;
fn3 (l || 0);
b = a;
n = j++;
k--;
fn2 (g);
fn2 (h);
fn2 (i);
if (k + f)
__builtin_abort ();
return 0;
}