gcc/testsuite/gcc.dg/20021018-1.c
raw| 1 | /* { dg-do run { target fpic } } */ |
| 2 | /* { dg-options "-O2 -fpic" } */ |
| 3 | |
| 4 | extern void abort (void); |
| 5 | extern void exit (int); |
| 6 | |
| 7 | #if __INT_MAX__ >= 2147483647L |
| 8 | static const long foo [10] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }; |
| 9 | |
| 10 | long __attribute__((noinline)) |
| 11 | bar (int x) |
| 12 | { |
| 13 | return foo [x - 0x6ffffffa]; |
| 14 | } |
| 15 | |
| 16 | int |
| 17 | main (void) |
| 18 | { |
| 19 | if (bar (0x6ffffffc) != 2) |
| 20 | abort (); |
| 21 | exit (0); |
| 22 | } |
| 23 | #else |
| 24 | int |
| 25 | main (void) |
| 26 | { |
| 27 | exit (0); |
| 28 | } |
| 29 | #endif |