1 /* { dg-do compile {target *-*-darwin* } } */
2 /* { dg-options "-std=c99 -w" } */
3
4 /* This has been designed to give the same section usage for
5 -m32 and -m64 - so don't put any ints or longs in it ... */
6
7 /* A zero-sized object. */
8 typedef struct _empty {} e_s;
9
10 /* These should go in .comm */
11 char ub;
12 e_s ea;
13 /* { dg-final { scan-assembler ".comm\[\t \]_ub,1" } } */
14 /* { dg-final { scan-assembler ".comm\[\t \]_ea,1" } } */
15
16 /* These should go into .data */
17 char a = 0;
18 short b = 0;
19 /* { dg-final { scan-assembler ".globl _a.*.data.*.space\[\t \]1" } } */
20 /* { dg-final { scan-assembler ".globl _b.*.data.*.space\[\t \]2" } } */
21
22 /* These should go into __pu_bssN */
23 long long d = 0;
24 float e = 0;
25 double f = 0;
26 long double g = 0.L;
27 long long al_256 __attribute__((aligned (256))) = 0;
28 /* { dg-final { scan-assembler ".zerofill __DATA,__pu_bss3,_d,8,3" } } */
29 /* { dg-final { scan-assembler ".zerofill __DATA,__pu_bss2,_e,4,2" } } */
30 /* { dg-final { scan-assembler ".zerofill __DATA,__pu_bss3,_f,8,3" } } */
31 /* { dg-final { scan-assembler ".zerofill __DATA,__pu_bss4,_g,16,4" } } */
32 /* { dg-final { scan-assembler ".zerofill __DATA,__pu_bss8,_al_256,8,8" } } */
33
34 /* This should go into __zo_bss0 */
35 static e_s sea;
36 /* { dg-final { scan-assembler ".zerofill __DATA,__zo_bss0,_sea,1" } } */
37
38 /* These should go into .static_data */
39 static char sa ;
40 static short sb ;
41 /* { dg-final { scan-assembler ".static_data.*_sa:.*.space\[\t \]1" } } */
42 /* { dg-final { scan-assembler ".static_data.*_sb:.*.space\[\t \]2" } } */
43
44 /* These should go into _bssN */
45 static long long sd;
46 static float se ;
47 static double sf ;
48 static long double sg;
49 static long long sal_256 __attribute__((aligned (2048)));
50 /* { dg-final { scan-assembler ".zerofill __DATA,__bss3,_sd,8,3" } } */
51 /* { dg-final { scan-assembler ".zerofill __DATA,__bss2,_se,4,2" } } */
52 /* { dg-final { scan-assembler ".zerofill __DATA,__bss3,_sf,8,3" } } */
53 /* { dg-final { scan-assembler ".zerofill __DATA,__bss4,_sg,16,4" } } */
54 /* { dg-final { scan-assembler ".zerofill __DATA,__bss11,_sal_256,8,11" } } */
55
foo(int x)56 long long foo (int x)
57 {
58 e_s *s;
59 a += x + sa;
60 b += a + sb;
61 d += b + sd;
62 e += d + se;
63 f += e + sf;
64 g += f + sg;
65
66 s = &ea;
67 s = &sea;
68
69 b += al_256;
70 b += sal_256;
71
72 return (long long) sd + b;
73 }
74