Skip to content

Commit 7ae79ab

Browse files
Add test for mismatched alignments on gcc
1 parent f590402 commit 7ae79ab

File tree

2 files changed

+45
-0
lines changed

2 files changed

+45
-0
lines changed
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
| test.c:11:8:11:15 | alignas(...) | Variable g4 declared with lexically different _Alignof() values '$@' and '$@' | test.c:11:8:11:15 | alignas(...) | 16 | test.c:12:8:12:15 | alignas(...) | 32 |
2+
| test.c:12:8:12:15 | alignas(...) | Variable g4 declared with lexically different _Alignof() values '$@' and '$@' | test.c:12:8:12:15 | alignas(...) | 32 | test.c:11:8:11:15 | alignas(...) | 16 |
3+
| test.c:18:8:18:15 | alignas(...) | Variable g6 declared with lexically different _Alignof() values '$@' and '$@' | test.c:18:8:18:15 | alignas(...) | int | test.c:19:8:19:15 | alignas(...) | 4 |
4+
| test.c:19:8:19:15 | alignas(...) | Variable g6 declared with lexically different _Alignof() values '$@' and '$@' | test.c:19:8:19:15 | alignas(...) | 4 | test.c:18:8:18:15 | alignas(...) | int |
5+
| test.c:22:8:22:15 | alignas(...) | Variable g7 declared with lexically different _Alignof() values '$@' and '$@' | test.c:22:8:22:15 | alignas(...) | ... * ... | test.c:23:8:23:15 | alignas(...) | 32 |
6+
| test.c:23:8:23:15 | alignas(...) | Variable g7 declared with lexically different _Alignof() values '$@' and '$@' | test.c:23:8:23:15 | alignas(...) | 32 | test.c:22:8:22:15 | alignas(...) | ... * ... |
7+
| test.c:28:8:28:15 | alignas(...) | Variable g9 declared with lexically different _Alignof() values '$@' and '$@' | test.c:28:8:28:15 | alignas(...) | ... * ... | test.c:29:8:29:15 | alignas(...) | ... * ... |
8+
| test.c:29:8:29:15 | alignas(...) | Variable g9 declared with lexically different _Alignof() values '$@' and '$@' | test.c:29:8:29:15 | alignas(...) | ... * ... | test.c:28:8:28:15 | alignas(...) | ... * ... |
9+
| test.c:34:8:34:15 | alignas(...) | Variable g11 declared with lexically different _Alignof() values '$@' and '$@' | test.c:34:8:34:15 | alignas(...) | signed int | test.c:35:8:35:15 | alignas(...) | unsigned int |
10+
| test.c:35:8:35:15 | alignas(...) | Variable g11 declared with lexically different _Alignof() values '$@' and '$@' | test.c:35:8:35:15 | alignas(...) | unsigned int | test.c:34:8:34:15 | alignas(...) | signed int |
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
extern _Alignas(16) int g1; // COMPLIANT
2+
extern _Alignas(16) int g1; // COMPLIANT
3+
4+
extern _Alignas(16) int g2;
5+
extern int g2; // NON_COMPLIANT
6+
7+
extern int g3; // NON_COMPLIANT
8+
extern _Alignas(16) int g3;
9+
10+
// Does not compile on clang:
11+
extern _Alignas(16) int g4; // COMPLIANT
12+
extern _Alignas(32) int g4; // COMPLIANT
13+
14+
extern int g5; // COMPLIANT
15+
extern int g5; // COMPLIANT
16+
17+
// Spec says elements must be lexically identical after macro expansion
18+
extern _Alignas(int) int g6; // NON_COMPLIANT
19+
extern _Alignas(4) int g6; // NON_COMPLIANT
20+
21+
#define THIRTY_TWO 32
22+
extern _Alignas(16 * 2) int g7; // NON_COMPLIANT
23+
extern _Alignas(32) int g7; // NON_COMPLIANT
24+
25+
extern _Alignas(THIRTY_TWO) int g8; // COMPLIANT
26+
extern _Alignas(32) int g8; // COMPLIANT
27+
28+
extern _Alignas(16 * 2) int g9; // NON_COMPLIANT
29+
extern _Alignas(2 * 16) int g9; // NON_COMPLIANT
30+
31+
extern _Alignas(int) int g10; // COMPLIANT
32+
extern _Alignas(int) int g10; // COMPLIANT
33+
34+
extern _Alignas(signed int) int g11; // NON_COMPLIANT
35+
extern _Alignas(unsigned int) int g11; // NON_COMPLIANT

0 commit comments

Comments
 (0)