Mercurial > hg > CbC > CbC_gcc
comparison gcc/testsuite/gcc.dg/20010912-1.c @ 111:04ced10e8804
gcc 7
author | kono |
---|---|
date | Fri, 27 Oct 2017 22:46:09 +0900 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
68:561a7518be6b | 111:04ced10e8804 |
---|---|
1 /* { dg-do run { target fpic } } */ | |
2 /* { dg-options "-O2 -fpic" } */ | |
3 | |
4 extern void abort (void); | |
5 extern void exit (int); | |
6 | |
7 int bar (int x, char **y) | |
8 { | |
9 if (x != 56) | |
10 abort (); | |
11 if (**y != 'a') | |
12 abort (); | |
13 *y = "def"; | |
14 return 1; | |
15 } | |
16 | |
17 int baz (int x, char **y) | |
18 { | |
19 if (x != 56) | |
20 abort (); | |
21 if (**y != 'a') | |
22 abort (); | |
23 return 26; | |
24 } | |
25 | |
26 int foo (int x, char *y) | |
27 { | |
28 int a; | |
29 char *b = y; | |
30 a = bar (x, &y); | |
31 if (a) | |
32 { | |
33 y = b; | |
34 a = baz (x, &y); | |
35 } | |
36 if (a) | |
37 return a; | |
38 | |
39 baz (x, &y); | |
40 return 0; | |
41 } | |
42 | |
43 int main () | |
44 { | |
45 if (foo (56, "abc") != 26) | |
46 abort (); | |
47 exit (0); | |
48 } |