File: darwin-aligned-globals.c

package info (click to toggle)
gcc-arm-none-eabi 15%3A14.2.rel1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,099,328 kB
  • sloc: cpp: 3,627,108; ansic: 2,571,498; ada: 834,230; f90: 235,082; makefile: 79,231; asm: 74,984; xml: 51,692; exp: 39,736; sh: 33,298; objc: 15,629; python: 15,069; fortran: 14,429; pascal: 7,003; awk: 5,070; perl: 3,106; ml: 285; lisp: 253; lex: 204; haskell: 135
file content (24 lines) | stat: -rw-r--r-- 1,112 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
/* { dg-do compile { target *-*-darwin* } } */
/* { dg-additional-options "-fcommon" } */

/* Test alignment rules which differ for earlier hosts (so we must
   work on the principle that this test will be exercised by self-
   hosted compilers. */

#if __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ >= 1070
#define align_OK (1ul << 28)
#define align_BAD (1ul << 29)
#else
#define align_OK (1ul << 15)
#define align_BAD (1ul << 16)
#endif

/* All non common vars are allowed larger alignment on modern systems.  */
static int xn __attribute__ ((aligned (align_OK)));
static int xi __attribute__ ((aligned (align_OK))) = 5  ;
int gxi __attribute__ ((aligned (align_OK))) = 6 ;

/* test that we detect bad cases.  */
static int yn __attribute__ ((aligned (align_BAD))); /* { dg-error {requested alignment .[0-9]+. exceeds object file maximum} } */
static int yi __attribute__ ((aligned (align_BAD))) = 5;  /* { dg-error {requested alignment .[0-9]+. exceeds object file maximum} } */
int yni __attribute__ ((aligned (align_BAD))) = 6;  /* { dg-error {requested alignment .[0-9]+. exceeds object file maximum} } */