]> granicus.if.org Git - clang/commitdiff
Fix for PR#13606: http://llvm.org/bugs/show_bug.cgi?id=13606
authorJohn Criswell <criswell@uiuc.edu>
Wed, 15 Aug 2012 18:40:30 +0000 (18:40 +0000)
committerJohn Criswell <criswell@uiuc.edu>
Wed, 15 Aug 2012 18:40:30 +0000 (18:40 +0000)
Changed the alignment of an LValue to be 64 bits so that we can handle
alignment values up to half of a 64-bit address space.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161971 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/CGValue.h
test/CodeGen/align-global-large.c [new file with mode: 0644]

index a46f313f1f7a7f1b485e23a07357f913f1c86284..c2b8e4da820cc4839c0e087b79826ea46b0829aa 100644 (file)
@@ -128,7 +128,7 @@ class LValue {
 
   // The alignment to use when accessing this lvalue.  (For vector elements,
   // this is the alignment of the whole vector.)
-  unsigned short Alignment;
+  int64_t Alignment;
 
   // objective-c's ivar
   bool Ivar:1;
diff --git a/test/CodeGen/align-global-large.c b/test/CodeGen/align-global-large.c
new file mode 100644 (file)
index 0000000..fcbe758
--- /dev/null
@@ -0,0 +1,18 @@
+// PR13606 - Clang crashes with large alignment attribute
+// RUN: %clang -S -emit-llvm %s -o - | FileCheck %s
+
+// CHECK: x
+// CHECK: align
+// CHECK: 1048576
+volatile char x[4000] __attribute__((aligned(0x100000)));
+
+int
+main (int argc, char ** argv) {
+  // CHECK: y
+  // CHECK: align
+  // CHECK: 1048576
+  volatile char y[4000] __attribute__((aligned(0x100000)));
+
+  return y[argc];
+}
+