r262466 - [Sema] PR26444 fix crash when alignment value is >= 2**16
David Majnemer via cfe-commits
cfe-commits at lists.llvm.org
Tue Mar 1 22:48:47 PST 2016
Author: majnemer
Date: Wed Mar 2 00:48:47 2016
New Revision: 262466
URL: http://llvm.org/viewvc/llvm-project?rev=262466&view=rev
Log:
[Sema] PR26444 fix crash when alignment value is >= 2**16
Sema allows max values up to 2**28, use unsigned instead of unsiged
short to hold values that large.
Differential Revision: http://reviews.llvm.org/D17248
Patch by Don Hinton!
Modified:
cfe/trunk/lib/CodeGen/CGValue.h
cfe/trunk/test/Sema/attr-aligned.c
Modified: cfe/trunk/lib/CodeGen/CGValue.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGValue.h?rev=262466&r1=262465&r2=262466&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGValue.h (original)
+++ cfe/trunk/lib/CodeGen/CGValue.h Wed Mar 2 00:48:47 2016
@@ -445,7 +445,7 @@ class AggValueSlot {
// Qualifiers
Qualifiers Quals;
- unsigned short Alignment;
+ unsigned Alignment;
/// DestructedFlag - This is set to true if some external code is
/// responsible for setting up a destructor for the slot. Otherwise
Modified: cfe/trunk/test/Sema/attr-aligned.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/attr-aligned.c?rev=262466&r1=262465&r2=262466&view=diff
==============================================================================
--- cfe/trunk/test/Sema/attr-aligned.c (original)
+++ cfe/trunk/test/Sema/attr-aligned.c Wed Mar 2 00:48:47 2016
@@ -3,6 +3,9 @@
int x __attribute__((aligned(3))); // expected-error {{requested alignment is not a power of 2}}
int y __attribute__((aligned(1 << 29))); // expected-error {{requested alignment must be 268435456 bytes or smaller}}
+// PR26444
+int y __attribute__((aligned(1 << 28)));
+
// PR3254
short g0[3] __attribute__((aligned));
short g0_chk[__alignof__(g0) == 16 ? 1 : -1];
More information about the cfe-commits
mailing list