aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--decl.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/decl.c b/decl.c
index 98ac497..0a5cf6d 100644
--- a/decl.c
+++ b/decl.c
@@ -1,4 +1,5 @@
#include <assert.h>
+#include <limits.h>
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
@@ -446,8 +447,8 @@ declspecs(struct scope *s, enum storageclass *sc, enum funcspec *fs, int *align)
expect(TLPAREN, "after 'alignas'");
other = typename(s, NULL);
i = other ? other->align : intconstexpr(s, false);
- if (i & (i - 1))
- error(&tok.loc, "invalid alignment: %d", i);
+ if (i & i - 1 || i > INT_MAX)
+ error(&tok.loc, "invalid alignment: %llu", i);
if (i > *align)
*align = i;
expect(TRPAREN, "to close 'alignas' specifier");