From 554fd8c5195424bdbcabf5de30fdc183aba391bd Mon Sep 17 00:00:00 2001 From: upstream source tree Date: Sun, 15 Mar 2015 20:14:05 -0400 Subject: obtained gcc-4.6.4.tar.bz2 from upstream website; verified gcc-4.6.4.tar.bz2.sig; imported gcc-4.6.4 source tree from verified upstream tarball. downloading a git-generated archive based on the 'upstream' tag should provide you with a source tree that is binary identical to the one extracted from the above tarball. if you have obtained the source via the command 'git clone', however, do note that line-endings of files in your working directory might differ from line-endings of the respective files in the upstream repository. --- gcc/testsuite/gcc.dg/darwin-sections.c | 73 ++++++++++++++++++++++++++++++++++ 1 file changed, 73 insertions(+) create mode 100644 gcc/testsuite/gcc.dg/darwin-sections.c (limited to 'gcc/testsuite/gcc.dg/darwin-sections.c') diff --git a/gcc/testsuite/gcc.dg/darwin-sections.c b/gcc/testsuite/gcc.dg/darwin-sections.c new file mode 100644 index 000000000..79d48bd7d --- /dev/null +++ b/gcc/testsuite/gcc.dg/darwin-sections.c @@ -0,0 +1,73 @@ +/* { dg-do compile {target *-*-darwin* } } */ +/* { dg-options "-std=c99 -w" } */ + +/* This has been designed to give the same section usage for + -m32 and -m64 - so don't put any ints or longs in it ... */ + +/* A zero-sized object. */ +typedef struct _empty {} e_s; + +/* These should go in .comm */ +char ub; +e_s ea; +/* { dg-final { scan-assembler ".comm\[\t \]_ub,1" } } */ +/* { dg-final { scan-assembler ".comm\[\t \]_ea,1" } } */ + +/* These should go into .data */ +char a = 0; +short b = 0; +/* { dg-final { scan-assembler ".globl _a.*.data.*.space\[\t \]1" } } */ +/* { dg-final { scan-assembler ".globl _b.*.data.*.space\[\t \]2" } } */ + +/* These should go into __pu_bssN */ +long long d = 0; +float e = 0; +double f = 0; +long double g = 0.L; +long long al_256 __attribute__((aligned (256))) = 0; +/* { dg-final { scan-assembler ".zerofill __DATA,__pu_bss3,_d,8,3" } } */ +/* { dg-final { scan-assembler ".zerofill __DATA,__pu_bss2,_e,4,2" } } */ +/* { dg-final { scan-assembler ".zerofill __DATA,__pu_bss3,_f,8,3" } } */ +/* { dg-final { scan-assembler ".zerofill __DATA,__pu_bss4,_g,16,4" } } */ +/* { dg-final { scan-assembler ".zerofill __DATA,__pu_bss8,_al_256,8,8" } } */ + +/* This should go into __zo_bss0 */ +static e_s sea; +/* { dg-final { scan-assembler ".zerofill __DATA,__zo_bss0,_sea,1" } } */ + +/* These should go into .static_data */ +static char sa ; +static short sb ; +/* { dg-final { scan-assembler ".static_data.*_sa:.*.space\[\t \]1" } } */ +/* { dg-final { scan-assembler ".static_data.*_sb:.*.space\[\t \]2" } } */ + +/* These should go into _bssN */ +static long long sd; +static float se ; +static double sf ; +static long double sg; +static long long sal_256 __attribute__((aligned (2048))); +/* { dg-final { scan-assembler ".zerofill __DATA,__bss3,_sd,8,3" } } */ +/* { dg-final { scan-assembler ".zerofill __DATA,__bss2,_se,4,2" } } */ +/* { dg-final { scan-assembler ".zerofill __DATA,__bss3,_sf,8,3" } } */ +/* { dg-final { scan-assembler ".zerofill __DATA,__bss4,_sg,16,4" } } */ +/* { dg-final { scan-assembler ".zerofill __DATA,__bss11,_sal_256,8,11" } } */ + +long long foo (int x) +{ + e_s *s; + a += x + sa; + b += a + sb; + d += b + sd; + e += d + se; + f += e + sf; + g += f + sg; + + s = &ea; + s = &sea; + + b += al_256; + b += sal_256; + + return (long long) sd + b; +} -- cgit v1.2.3