diff options
author | Carlo Zancanaro <carlo@pc-4w14-0.cs.usyd.edu.au> | 2012-10-15 17:10:06 +1100 |
---|---|---|
committer | Carlo Zancanaro <carlo@pc-4w14-0.cs.usyd.edu.au> | 2012-10-15 17:10:06 +1100 |
commit | be1de4be954c80875ad4108e0a33e8e131b2f2c0 (patch) | |
tree | 1fbbecf276bf7c7bdcbb4dd446099d6d90eaa516 /clang/test/Sema/attr-aligned.c | |
parent | c4626a62754862d20b41e8a46a3574264ea80e6d (diff) | |
parent | f1bd2e48c5324d3f7cda4090c87f8a5b6f463ce2 (diff) |
Merge branch 'master' of ssh://bitbucket.org/czan/honours
Diffstat (limited to 'clang/test/Sema/attr-aligned.c')
-rw-r--r-- | clang/test/Sema/attr-aligned.c | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/clang/test/Sema/attr-aligned.c b/clang/test/Sema/attr-aligned.c new file mode 100644 index 0000000..c094ff1 --- /dev/null +++ b/clang/test/Sema/attr-aligned.c @@ -0,0 +1,38 @@ +// RUN: %clang_cc1 -triple i386-apple-darwin9 -fsyntax-only -verify %s + +int x __attribute__((aligned(3))); // expected-error {{requested alignment is not a power of 2}} + +// PR3254 +short g0[3] __attribute__((aligned)); +short g0_chk[__alignof__(g0) == 16 ? 1 : -1]; + +// <rdar://problem/6840045> +typedef char ueber_aligned_char __attribute__((aligned(8))); + +struct struct_with_ueber_char { + ueber_aligned_char c; +}; + +char a = 0; + +char a0[__alignof__(ueber_aligned_char) == 8? 1 : -1] = { 0 }; +char a1[__alignof__(struct struct_with_ueber_char) == 8? 1 : -1] = { 0 }; +char a2[__alignof__(a) == 1? : -1] = { 0 }; +char a3[sizeof(a) == 1? : -1] = { 0 }; + +// rdar://problem/8335865 +int b __attribute__((aligned(2))); +char b1[__alignof__(b) == 2 ?: -1] = {0}; + +struct C { int member __attribute__((aligned(2))); } c; +char c1[__alignof__(c) == 4 ?: -1] = {0}; +char c2[__alignof__(c.member) == 4 ?: -1] = {0}; + +struct D { int member __attribute__((aligned(2))) __attribute__((packed)); } d; +char d1[__alignof__(d) == 2 ?: -1] = {0}; +char d2[__alignof__(d.member) == 2 ?: -1] = {0}; + +struct E { int member __attribute__((aligned(2))); } __attribute__((packed)); +struct E e; +char e1[__alignof__(e) == 2 ?: -1] = {0}; +char e2[__alignof__(e.member) == 2 ?: -1] = {0}; |