libcpp, c, middle-end: Optimize initializers using #embed in C
[official-gcc.git] / gcc / testsuite / gcc.dg / pr101223.c
blob6d5a247fa6c71bb28065db37a48602c60cbc73f1
1 /* PR tree-optimization/101223 */
2 /* { dg-do run } */
3 /* { dg-options "-O2 " } */
5 struct {
6 int a : 1;
7 } b;
8 int c = 1, d;
9 int foo1() {
10 for (; d < 2; d++) {
11 int e = ~c, f = 0, g;
12 if (e) {
13 f = c;
14 g = b.a;
15 b.a = f;
16 if (b.a >= g)
17 __builtin_abort();
19 c = f;
20 b.a = g;
22 return 0;
25 int foo2() {
26 for (; d < 2; d++) {
27 int e = ~c, f = 0, g;
28 if (e) {
29 f = c;
30 g = b.a;
31 b.a = f;
32 if (g <= b.a)
33 __builtin_abort();
35 c = f;
36 b.a = g;
38 return 0;
40 int main ()
42 return foo1() + foo2();