PR tree-optimization/81303
[official-gcc.git] / gcc / testsuite / gcc.dg / 20070507-1.c
blob684002f6f911e66223c224341c895d36140849ef
1 /* This failed on s390x due to bug in loop.c.
2 loop.c failed to remove a REG_EQUAL note when
3 hoisting an insn from a loop body. */
5 /* { dg-options "-O3 -fPIC" } */
6 /* { dg-do run { target fpic } } */
8 typedef __SIZE_TYPE__ size_t;
9 int memcmp(const void *s1, const void *s2, size_t n);
11 typedef struct
13 char name[30];
14 int a;
15 } LOCAL;
17 int global = 0;
18 int sy = 1;
19 int subroutine_offset;
21 LOCAL local = { "local", 0 };
22 LOCAL keywords = { "keywords", 1 };
23 int local_table = 0;
24 int keywords_table = 0;
26 void __attribute__((noinline)) bar (char *p_buffer)
28 p_buffer[255] = 1;
31 int __attribute__((noinline)) foo (char *p_str1)
33 global = 1;
34 return 1;
37 int __attribute__((noinline)) loop_next (int *p_table, char *p_table_head)
39 static int loop_next = 0;
41 if (loop_next == 1)
42 return 1;
44 loop_next = 1;
45 return 0;
48 int
49 main ()
51 char buffer[256];
52 int ende = 0;
53 int index;
54 int local_base = 2;
56 keywords.a = 1;
57 for (sy = 0;; sy++)
59 for (index = 1;;)
61 bar (buffer);
62 if (buffer[sy] != 0)
64 ende = 1;
65 break;
67 if (foo (buffer))
69 keywords.a += index - 1;
70 break;
72 index++;
74 if (ende)
75 break;
78 subroutine_offset = 0;
80 for (;;)
82 if (loop_next (&keywords_table, (char*)&keywords))
83 break;
85 if ((!memcmp (keywords.name, "+++", 3)))
86 local_base = 100;
87 else
88 local_base = 0;
90 if ((!memcmp (keywords.name, "+++", 3)))
91 subroutine_offset += local_table;
93 for (;;)
95 if (loop_next (&local_table, (char*)&local))
96 break;;
97 if ((local.a == 0))
98 continue;;
99 foo (local.name);
102 return 0;