diff options
Diffstat (limited to 'gcc/testsuite/gcc.dg/array-quals-1.c')
-rw-r--r-- | gcc/testsuite/gcc.dg/array-quals-1.c | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/array-quals-1.c b/gcc/testsuite/gcc.dg/array-quals-1.c new file mode 100644 index 000000000..f01db686b --- /dev/null +++ b/gcc/testsuite/gcc.dg/array-quals-1.c @@ -0,0 +1,30 @@ +/* Test for various combinations of const, arrays and typedefs: + should never actually get const on the final array type, but + all should end up in a read-only section. PR c/12165. */ +/* Origin: Joseph Myers <jsm@polyomino.org.uk> */ +/* { dg-do compile } */ +/* The MMIX port always switches to the .data section at the end of a file. */ +/* { dg-final { scan-assembler-not "\\.data(?!\\.rel\\.ro)" { xfail powerpc*-*-aix* mmix-*-* x86_64-*-mingw* picochip--*-* avr-*-*} } } */ +static const int a[2] = { 1, 2 }; +const int a1[2] = { 1, 2 }; +typedef const int ci; +static ci b[2] = { 3, 4 }; +ci b1[2] = { 3, 4 }; +typedef int ia[2]; +static const ia c = { 5, 6 }; +const ia c1 = { 5, 6 }; +typedef const int cia[2]; +static cia d = { 7, 8 }; +cia d1 = { 7, 8 }; +static cia e[2] = { { 1, 2 }, { 3, 4 } }; +cia e1[2] = { { 1, 2 }, { 3, 4 } }; +void *const p = &a; +void *const q = &b; +void *const r = &c; +void *const s = &d; +void *const t = &e; +void *const p1 = &a1; +void *const q1 = &b1; +void *const r1 = &c1; +void *const s1 = &d1; +void *const t1 = &e1; |