Small ChangeLog tweak.
[official-gcc.git] / gcc / testsuite / gcc.dg / torture / pr67828.c
blobc7b696501a52550b960fead2e8b5a42d8be35da0
1 /* Check that we don't misoptimize the final value of d. We used to
2 apply loop unswitching on if(j), introducing undefined behavior
3 that the original code wouldn't exercise, and this undefined
4 behavior would get later passes to misoptimize the loop. */
6 /* { dg-do run } */
8 #include <stdio.h>
9 #include <stdlib.h>
11 int x;
13 int __attribute__ ((noinline, noclone))
14 xprintf (int d) {
15 if (d)
17 if (x)
18 printf ("%d", d);
19 abort ();
23 int a, b;
24 short c;
26 int
27 main ()
29 int j, d = 1;
30 for (; c >= 0; c++)
32 a = d;
33 d = 0;
34 if (b)
36 xprintf (0);
37 if (j)
38 xprintf (0);
41 xprintf (d);
42 exit (0);