RISC-V: Fix factor in dwarf_poly_indeterminate_value [PR116305]
[official-gcc.git] / gcc / testsuite / gcc.dg / ipa / ipa-sra-15.c
blobaa13a94c7c06406867a88d6354912ea2370288ab
1 /* { dg-do run } */
2 /* { dg-options "-O2 -fipa-sra -fdump-ipa-sra" } */
4 /* Check of a recursive by-reference structure split. The recursive functions
5 have to be pure right from the start, otherwise the current AA would detect
6 possible modification of data. */
8 struct S
10 float red;
11 void *blue;
12 int green;
15 void __attribute__((noipa))
16 check (float r, int g, int g2)
18 if (r < 7.39 || r > 7.41
19 || g != 6 || g2 != 6)
20 __builtin_abort ();
21 return;
24 static int __attribute__((noinline, pure)) bar (struct S *s, int rec);
26 static int
27 __attribute__((noinline, pure))
28 foo (struct S *s , int rec)
30 int t = 0;
31 if (rec)
32 t = bar (s, 0);
33 check (s->red, s->green, s->green);
34 return t;
37 static int
38 __attribute__((noinline, pure))
39 bar (struct S *s, int rec)
41 int t = foo (s, rec);
42 return t + t;
45 volatile int g;
47 int
48 main (int argc, char **argv)
50 struct S s;
52 s.red = 7.4;
53 s.green = 6;
54 s.blue = &s;
56 g = bar (&s, 1);
57 return 0;
60 /* { dg-final { scan-ipa-dump-times "Will split parameter" 2 "sra" } } */
61 /* { dg-final { scan-ipa-dump-times "component at byte offset" 4 "sra" } } */