Require target lra in gcc.dg/pr108095.c
[official-gcc.git] / gcc / testsuite / gcc.dg / pr111009.c
blob3accd9ac0630756385c1807a5e4bc18674c6b2ec
1 /* PR tree-optimization/111009 */
2 /* { dg-do run } */
3 /* { dg-options "-O3 -fno-strict-overflow" } */
5 struct dso {
6 struct dso * next;
7 int maj;
8 };
10 __attribute__((noipa)) static void __dso_id__cmp_(void) {}
12 __attribute__((noipa))
13 static int bug(struct dso * d, struct dso *dso)
15 struct dso **p = &d;
16 struct dso *curr = 0;
18 while (*p) {
19 curr = *p;
20 // prevent null deref below
21 if (!dso) return 1;
22 if (dso == curr) return 1;
24 int *a = &dso->maj;
25 // null deref
26 if (!(a && *a)) __dso_id__cmp_();
28 p = &curr->next;
30 return 0;
33 __attribute__((noipa))
34 int main(void) {
35 struct dso d = { 0, 0, };
36 bug(&d, 0);