diff options
Diffstat (limited to 'gcc/testsuite/gcc.dg/20021029-1.c')
-rw-r--r-- | gcc/testsuite/gcc.dg/20021029-1.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/20021029-1.c b/gcc/testsuite/gcc.dg/20021029-1.c new file mode 100644 index 000000000..bc330c56f --- /dev/null +++ b/gcc/testsuite/gcc.dg/20021029-1.c @@ -0,0 +1,17 @@ +/* Test whether difference of local labels doesn't force + variables into writable sections. */ +/* { dg-do compile { target fpic } } */ +/* { dg-options "-O2 -fpic" } */ +/* { dg-options "-O2 -fpic -mpt-fixed" { target sh64*-*-* } } */ +/* { dg-final { scan-assembler-not ".data.rel.ro.local" } } */ + +int foo (int a) +{ + static const int ar[] = { &&l1 - &&l1, &&l2 - &&l1 }; + void *p = &&l1 + ar[a]; + goto *p; + l1: + return 1; + l2: + return 2; +} |