2018-04-09 Richard Biener <rguenther@suse.de>
[official-gcc.git] / gcc / testsuite / gcc.dg / auto-type-1.c
blob882bf2c13fba9b2f0c4615d4fbb907bbcf957d40
1 /* Test __auto_type. Test correct uses. */
2 /* { dg-do run } */
3 /* { dg-options "" } */
4 /* { dg-require-effective-target alloca } */
6 extern void abort (void);
7 extern void exit (int);
9 __auto_type i = 1;
10 extern int i;
11 __auto_type c = (char) 1;
12 extern char c;
13 static __auto_type u = 10U;
14 extern unsigned int u;
15 const __auto_type ll = 1LL;
16 extern const long long ll;
18 int
19 main (void)
21 if (i != 1 || c != 1 || u != 10U)
22 abort ();
23 __auto_type ai = i;
24 int *aip = &ai;
25 if (ai != 1)
26 abort ();
27 __auto_type p = (int (*) [++i]) 0;
28 if (i != 2)
29 abort ();
30 if (sizeof (*p) != 2 * sizeof (int))
31 abort ();
32 int vla[u][u];
33 int (*vp)[u] = &vla[0];
34 __auto_type vpp = ++vp;
35 if (vp != &vla[1])
36 abort ();
37 exit (0);