]> git.ipfire.org Git - thirdparty/gcc.git/blob - gcc/testsuite/gcc.dg/darwin-aligned-globals.c
Update copyright years.
[thirdparty/gcc.git] / gcc / testsuite / gcc.dg / darwin-aligned-globals.c
1 /* { dg-do compile { target *-*-darwin* } } */
2 /* { dg-additional-options "-fcommon" } */
3
4 /* Test alignment rules which differ for earlier hosts (so we must
5 work on the principle that this test will be exercised by self-
6 hosted compilers. */
7
8 #if __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ >= 1070
9 #define align_OK (1ul << 28)
10 #define align_BAD (1ul << 29)
11 #else
12 #define align_OK (1ul << 15)
13 #define align_BAD (1ul << 16)
14 #endif
15
16 /* All non common vars are allowed larger alignment on modern systems. */
17 static int xn __attribute__ ((aligned (align_OK)));
18 static int xi __attribute__ ((aligned (align_OK))) = 5 ;
19 int gxi __attribute__ ((aligned (align_OK))) = 6 ;
20
21 /* test that we detect bad cases. */
22 static int yn __attribute__ ((aligned (align_BAD))); /* { dg-error {requested alignment .[0-9]+. exceeds object file maximum} } */
23 static int yi __attribute__ ((aligned (align_BAD))) = 5; /* { dg-error {requested alignment .[0-9]+. exceeds object file maximum} } */
24 int yni __attribute__ ((aligned (align_BAD))) = 6; /* { dg-error {requested alignment .[0-9]+. exceeds object file maximum} } */