From ebdae640721cd7be00db01b6e5d0793b46926f3b Mon Sep 17 00:00:00 2001 From: Michael Forney Date: Sun, 11 Apr 2021 17:35:43 -0700 Subject: decl: Allow _Alignas(0) C11 6.7.5p6 says "An alignment specification of zero has no effect". --- test/alignas-0.c | 3 +++ test/alignas-0.qbe | 3 +++ test/alignas-type.c | 1 + test/alignas-type.qbe | 1 + test/alignas.c | 2 +- test/alignas.qbe | 2 +- 6 files changed, 10 insertions(+), 2 deletions(-) create mode 100644 test/alignas-0.c create mode 100644 test/alignas-0.qbe create mode 100644 test/alignas-type.c create mode 100644 test/alignas-type.qbe (limited to 'test') diff --git a/test/alignas-0.c b/test/alignas-0.c new file mode 100644 index 0000000..402e7ee --- /dev/null +++ b/test/alignas-0.c @@ -0,0 +1,3 @@ +_Alignas(0) int x; +_Alignas(8) _Alignas(0) int y; +_Alignas(0) _Alignas(16) int z; diff --git a/test/alignas-0.qbe b/test/alignas-0.qbe new file mode 100644 index 0000000..849fb58 --- /dev/null +++ b/test/alignas-0.qbe @@ -0,0 +1,3 @@ +export data $x = align 4 { z 4 } +export data $y = align 8 { z 4 } +export data $z = align 16 { z 4 } diff --git a/test/alignas-type.c b/test/alignas-type.c new file mode 100644 index 0000000..394045d --- /dev/null +++ b/test/alignas-type.c @@ -0,0 +1 @@ +_Alignas(int) char x[4]; diff --git a/test/alignas-type.qbe b/test/alignas-type.qbe new file mode 100644 index 0000000..7cf0e40 --- /dev/null +++ b/test/alignas-type.qbe @@ -0,0 +1 @@ +export data $x = align 4 { z 4 } diff --git a/test/alignas.c b/test/alignas.c index 394045d..b714d37 100644 --- a/test/alignas.c +++ b/test/alignas.c @@ -1 +1 @@ -_Alignas(int) char x[4]; +_Alignas(8) int x; diff --git a/test/alignas.qbe b/test/alignas.qbe index 7cf0e40..6dd5505 100644 --- a/test/alignas.qbe +++ b/test/alignas.qbe @@ -1 +1 @@ -export data $x = align 4 { z 4 } +export data $x = align 8 { z 4 } -- cgit v1.2.3