1 /* Test whether difference of local labels doesn't force
2    variables into writable sections.  */
3 /* { dg-do compile { target fpic } } */
4 /* { dg-options "-O2 -fpic" } */
5 /* { dg-final { scan-assembler-not ".data.rel.ro.local" } } */
6 /* { dg-final { scan-assembler-symbol-section {^_?ar} {^\.(const|rodata)|\[RO\]} } } */
7 /* { dg-require-effective-target label_values } */
8 /* { dg-require-effective-target indirect_jumps } */
9 
foo(int a)10 int foo (int a)
11 {
12   static const int ar[] = { &&l1 - &&l1, &&l2 - &&l1 };
13   void *p = &&l1 + ar[a];
14   goto *p;
15   l1:
16     return 1;
17   l2:
18     return 2;
19 }
20