From: David Majnemer Date: Wed, 2 Mar 2016 06:48:47 +0000 (+0000) Subject: [Sema] PR26444 fix crash when alignment value is >= 2**16 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=1684c47142a9ee2e4fa55c720a0180704ba81465;p=clang [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! git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@262466 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/CodeGen/CGValue.h b/lib/CodeGen/CGValue.h index 3ccc4cda89..53a376df64 100644 --- a/lib/CodeGen/CGValue.h +++ b/lib/CodeGen/CGValue.h @@ -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 diff --git a/test/Sema/attr-aligned.c b/test/Sema/attr-aligned.c index 0a2698ec91..b8d2fc6863 100644 --- a/test/Sema/attr-aligned.c +++ b/test/Sema/attr-aligned.c @@ -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];