http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52406
--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> 2012-02-28
09:54:01 UTC ---
Strangely,
/* PR tree-optimization/52406 */
extern void abort (void);
struct { int f1; } a[2];
int *b, *const k = &a[1].f1;
static int **c = &b;
int e, f, d;
int
main ()
{
int **l = &b;
*l = k;
for (; d <= 0; d++)
{
int *j = &e;
**c = 1;
*l = k;
*k ^= 0;
f = **l;
*j = f;
}
if (e != 1)
abort ();
return 0;
}
fails, but with
--- pr52406.c 2012-02-28 10:47:45.663204390 +0100
+++ pr52406.c 2012-02-28 10:47:56.695143490 +0100
@@ -1,9 +1,9 @@
/* PR tree-optimization/52406 */
extern void abort (void);
-struct { int f1; } a[2];
+int a[2];
-int *b, *const k = &a[1].f1;
+int *b, *const k = &a[1];
static int **c = &b;
int e, f, d;
it works (IL starts to differ during pcom), beyond the &a[1] vs. &a[1].f1
changes. So even if there isn't a wrong code, there would be at least
missed-optimization.