Debian Codegraph @

gcc/testsuite/gcc.c-torture/execute/20021118-2.c

raw
1 /* Originally added to test SH constant pool layout. t1() failed for
2 non-PIC and t2() failed for PIC. */
3
4 void abort (void);
5 void exit (int);
6
7 int t1 (float *f, int i,
8 void (*f1) (double),
9 void (*f2) (float, float))
10 {
11 f1 (3.0);
12 f[i] = f[i + 1];
13 f2 (2.5f, 3.5f);
14 }
15
16 int t2 (float *f, int i,
17 void (*f1) (double),
18 void (*f2) (float, float),
19 void (*f3) (float))
20 {
21 f3 (6.0f);
22 f1 (3.0);
23 f[i] = f[i + 1];
24 f2 (2.5f, 3.5f);
25 }
26
27 void f1 (double d)
28 {
29 if (d != 3.0)
30 abort ();
31 }
32
33 void f2 (float f1, float f2)
34 {
35 if (f1 != 2.5f || f2 != 3.5f)
36 abort ();
37 }
38
39 void f3 (float f)
40 {
41 if (f != 6.0f)
42 abort ();
43 }
44
45 int main ()
46 {
47 float f[3] = { 2.0f, 3.0f, 4.0f };
48 t1 (f, 0, f1, f2);
49 t2 (f, 1, f1, f2, f3);
50 if (f[0] != 3.0f && f[1] != 4.0f)
51 abort ();
52 exit (0);
53 }