PR middle-end/77357 - strlen of constant strings not folded
[official-gcc.git] / gcc / testsuite / gcc.dg / array-quals-1.c
blob3981c916021d86ed2f89a770099ebed7ce3a2887
1 /* Test for various combinations of const, arrays and typedefs:
2 should never actually get const on the final array type, but
3 all should end up in a read-only section. PR c/12165. */
4 /* Origin: Joseph Myers <jsm@polyomino.org.uk> */
5 /* { dg-do compile } */
6 /* { dg-options "-Wno-discarded-array-qualifiers" } */
7 /* The MMIX port always switches to the .data section at the end of a file. */
8 /* { dg-final { scan-assembler-not "\\.data(?!\\.rel\\.ro)" { xfail powerpc*-*-aix* mmix-*-* x86_64-*-mingw* } } } */
9 static const int a[2] = { 1, 2 };
10 const int a1[2] = { 1, 2 };
11 typedef const int ci;
12 static ci b[2] = { 3, 4 };
13 ci b1[2] = { 3, 4 };
14 typedef int ia[2];
15 static const ia c = { 5, 6 };
16 const ia c1 = { 5, 6 };
17 typedef const int cia[2];
18 static cia d = { 7, 8 };
19 cia d1 = { 7, 8 };
20 static cia e[2] = { { 1, 2 }, { 3, 4 } };
21 cia e1[2] = { { 1, 2 }, { 3, 4 } };
22 void *const p = &a;
23 void *const q = &b;
24 void *const r = &c;
25 void *const s = &d;
26 void *const t = &e;
27 void *const p1 = &a1;
28 void *const q1 = &b1;
29 void *const r1 = &c1;
30 void *const s1 = &d1;
31 void *const t1 = &e1;