aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/20021029-1.c
blob: f5ddecb7c2855c11c8ecbc3fb17c935ac1c6dafc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
/* Test whether difference of local labels doesn't force
   variables into writable sections.  */
/* { dg-do compile { target fpic } } */
/* { dg-options "-O2 -fpic" } */
/* { dg-additional-options "-G0" { target nios2-*-* } }  */
/* { dg-final { scan-assembler-not ".data.rel.ro.local" } } */
/* { dg-final { scan-assembler-symbol-section {^_?ar} {^\.(const|rodata)|\[RO\]} } } */
/* { dg-require-effective-target label_values } */
/* { dg-require-effective-target indirect_jumps } */

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;
}