Daily bump.
[official-gcc.git] / gcc / testsuite / gcc.dg / darwin-sections.c
blobdbe37027f89f7d648cdc0626d0e20f41d55a663b
1 /* { dg-do compile {target *-*-darwin* } } */
2 /* { dg-options "-std=c99 -w -fcommon" } */
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 ... */
7 /* A zero-sized object. */
8 typedef struct _empty {} e_s;
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" } } */
16 /* These should go into __DATA,__common */
17 char a = 0;
18 short b = 0;
19 long long d = 0;
20 float e = 0;
21 double f = 0;
22 long double g = 0.L;
23 long long al_256 __attribute__((aligned (256))) = 0;
24 /* { dg-final { scan-assembler {.zerofill __DATA,__common,_a,1,0} } } */
25 /* { dg-final { scan-assembler {.zerofill __DATA,__common,_b,2,1} } } */
26 /* { dg-final { scan-assembler {.zerofill __DATA,__common,_d,8,3} } } */
27 /* { dg-final { scan-assembler {.zerofill __DATA,__common,_e,4,2} } } */
28 /* { dg-final { scan-assembler {.zerofill __DATA,__common,_f,8,3} } } */
29 /* long double can be 64 or 128 bits depending on the Darwin subtarget. */
30 /* { dg-final { scan-assembler {.zerofill __DATA,__common,_g,(16,4|8,3)} } } */
31 /* { dg-final { scan-assembler {.zerofill __DATA,__common,_al_256,8,8} } } */
33 /* These should go into __DATA,__bss */
34 static e_s sea;
35 static char sa ;
36 static short sb ;
37 static long long sd;
38 static float se ;
39 static double sf ;
40 static long double sg;
41 static long long sal_256 __attribute__((aligned (2048)));
42 /* { dg-final { scan-assembler {.zerofill __DATA,__bss,_sea,1,0} } } */
43 /* { dg-final { scan-assembler {.zerofill __DATA,__bss,_sa,1,0} } } */
44 /* { dg-final { scan-assembler {.zerofill __DATA,__bss,_sb,2,1} } } */
45 /* { dg-final { scan-assembler {.zerofill __DATA,__bss,_sd,8,3} } } */
46 /* { dg-final { scan-assembler {.zerofill __DATA,__bss,_se,4,2} } } */
47 /* { dg-final { scan-assembler {.zerofill __DATA,__bss,_sf,8,3} } } */
48 /* long double can be 64 or 128 bits depending on the Darwin subtarget. */
49 /* { dg-final { scan-assembler {.zerofill __DATA,__bss,_sg,(16,4|8,3)} } } */
50 /* { dg-final { scan-assembler {.zerofill __DATA,__bss,_sal_256,8,11} } } */
52 long long foo (int x)
54 e_s *s;
55 a += x + sa;
56 b += a + sb;
57 d += b + sd;
58 e += d + se;
59 f += e + sf;
60 g += f + sg;
62 s = &ea;
63 s = &sea;
65 b += al_256;
66 b += sal_256;
68 return (long long) sd + b;