diff options
| author | Michael Forney <mforney@mforney.org> | 2019-04-05 11:24:08 -0700 | 
|---|---|---|
| committer | Michael Forney <mforney@mforney.org> | 2019-04-05 11:24:45 -0700 | 
| commit | 3411746ee9e93981ad0a9c28fc6e33d5d4c9bfd4 (patch) | |
| tree | fd569e2f7fd6fa28d578ddf6a9f90253d2ecd659 | |
| parent | 6380b5cd6643bc0101e81c4da46d244466cda141 (diff) | |
| download | cproc-3411746ee9e93981ad0a9c28fc6e33d5d4c9bfd4.tar.xz | |
Fix _Alignas with type specifier
| -rw-r--r-- | decl.c | 8 | ||||
| -rw-r--r-- | tests/alignas.c | 1 | ||||
| -rw-r--r-- | tests/alignas.qbe | 1 | 
3 files changed, 6 insertions, 4 deletions
| @@ -228,7 +228,7 @@ tagspec(struct scope *s)  static struct type *  declspecs(struct scope *s, enum storageclass *sc, enum funcspec *fs, int *align)  { -	struct type *t; +	struct type *t, *other;  	struct decl *d;  	enum typespec ts = SPECNONE;  	enum typequal tq = QUALNONE; @@ -341,9 +341,9 @@ declspecs(struct scope *s, enum storageclass *sc, enum funcspec *fs, int *align)  				error(&tok.loc, "alignment specifier not allowed in this declaration");  			next();  			expect(TLPAREN, "after '_Alignas'"); -			t = typename(s); -			if (t) { -				*align = t->align; +			other = typename(s); +			if (other) { +				*align = other->align;  			} else {  				i = intconstexpr(s, false);  				if (!i || i & (i - 1) || i > 16) diff --git a/tests/alignas.c b/tests/alignas.c new file mode 100644 index 0000000..394045d --- /dev/null +++ b/tests/alignas.c @@ -0,0 +1 @@ +_Alignas(int) char x[4]; diff --git a/tests/alignas.qbe b/tests/alignas.qbe new file mode 100644 index 0000000..7cf0e40 --- /dev/null +++ b/tests/alignas.qbe @@ -0,0 +1 @@ +export data $x = align 4 { z 4 } | 
