aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/c-c++-common/pr95237-6.c
blob: 5e7396d7f4e1cd73482d5b4a22099ca18fd35ba5 (plain)
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 run { target { i?86-*-* x86_64-*-* } } } */
/* { dg-options "-O2" } */
#include <stddef.h>
#ifdef  __x86_64__
# define EXP_ALIGN 8
#else
# define EXP_ALIGN 4
#endif

struct test
{
  char a;
  long long b;
};
struct test global_var;
int main()
{
  	struct test local_var;
	if (__alignof__(global_var) != EXP_ALIGN
	    || __alignof__(local_var) != EXP_ALIGN
	    || offsetof(struct test, b) != EXP_ALIGN)
	  __builtin_abort();
	return 0;
}