[cfe-commits] r129337 - in /cfe/trunk: lib/CodeGen/CodeGenModule.cpp test/CodeGenCXX/global-init.cpp

John McCall rjmccall at apple.com
Mon Apr 11 18:01:22 PDT 2011


Author: rjmccall
Date: Mon Apr 11 20:01:22 2011
New Revision: 129337

URL: http://llvm.org/viewvc/llvm-project?rev=129337&view=rev
Log:
Ignore indirect field declarations.  Fixes PR9570.


Modified:
    cfe/trunk/lib/CodeGen/CodeGenModule.cpp
    cfe/trunk/test/CodeGenCXX/global-init.cpp

Modified: cfe/trunk/lib/CodeGen/CodeGenModule.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenModule.cpp?rev=129337&r1=129336&r2=129337&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CodeGenModule.cpp (original)
+++ cfe/trunk/lib/CodeGen/CodeGenModule.cpp Mon Apr 11 20:01:22 2011
@@ -2034,6 +2034,11 @@
     EmitGlobal(cast<VarDecl>(D));
     break;
 
+  // Indirect fields from global anonymous structs and unions can be
+  // ignored; only the actual variable requires IR gen support.
+  case Decl::IndirectField:
+    break;
+
   // C++ Decls
   case Decl::Namespace:
     EmitNamespace(cast<NamespaceDecl>(D));

Modified: cfe/trunk/test/CodeGenCXX/global-init.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/global-init.cpp?rev=129337&r1=129336&r2=129337&view=diff
==============================================================================
--- cfe/trunk/test/CodeGenCXX/global-init.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/global-init.cpp Mon Apr 11 20:01:22 2011
@@ -90,6 +90,13 @@
 // CHECK-NEXT:   sub
 // CHECK-NEXT:   store i32 {{.*}}, i32* @_ZN5test1L1yE
 
+// PR9570: the indirect field shouldn't crash IR gen.
+namespace test5 {
+  union {
+    unsigned bar[4096] __attribute__((aligned(128)));
+  };
+}
+
 // At the end of the file, we check that y is initialized before z.
 
 // CHECK: define internal void @_GLOBAL__I_a() section "__TEXT,__StaticInit,regular,pure_instructions" {





More information about the cfe-commits mailing list