[cfe-commits] r161971 - in /cfe/trunk: lib/CodeGen/CGValue.h test/CodeGen/align-global-large.c

John Criswell criswell at uiuc.edu
Wed Aug 15 11:40:30 PDT 2012


Author: criswell
Date: Wed Aug 15 13:40:30 2012
New Revision: 161971

URL: http://llvm.org/viewvc/llvm-project?rev=161971&view=rev
Log:
Fix for PR#13606: http://llvm.org/bugs/show_bug.cgi?id=13606
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.

Added:
    cfe/trunk/test/CodeGen/align-global-large.c
Modified:
    cfe/trunk/lib/CodeGen/CGValue.h

Modified: cfe/trunk/lib/CodeGen/CGValue.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGValue.h?rev=161971&r1=161970&r2=161971&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGValue.h (original)
+++ cfe/trunk/lib/CodeGen/CGValue.h Wed Aug 15 13:40:30 2012
@@ -128,7 +128,7 @@
 
   // 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;

Added: cfe/trunk/test/CodeGen/align-global-large.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/align-global-large.c?rev=161971&view=auto
==============================================================================
--- cfe/trunk/test/CodeGen/align-global-large.c (added)
+++ cfe/trunk/test/CodeGen/align-global-large.c Wed Aug 15 13:40:30 2012
@@ -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];
+}
+





More information about the cfe-commits mailing list