[cfe-commits] r133931 - in /cfe/trunk: lib/CodeGen/CGExpr.cpp test/CodeGen/PR10204-fun-lvalue.c

Nico Weber nicolasweber at gmx.de
Mon Jun 27 12:46:54 PDT 2011


Author: nico
Date: Mon Jun 27 14:46:54 2011
New Revision: 133931

URL: http://llvm.org/viewvc/llvm-project?rev=133931&view=rev
Log:
Revert parts of r133860 to fix a crash. Add a test.


Added:
    cfe/trunk/test/CodeGen/PR10204-fun-lvalue.c
Modified:
    cfe/trunk/lib/CodeGen/CGExpr.cpp

Modified: cfe/trunk/lib/CodeGen/CGExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGExpr.cpp?rev=133931&r1=133930&r2=133931&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGExpr.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGExpr.cpp Mon Jun 27 14:46:54 2011
@@ -791,7 +791,9 @@
     return RValue::get(EmitARCLoadWeak(LV.getAddress()));
 
   if (LV.isSimple()) {
-    assert(!LV.getType()->isFunctionType());
+    // Functions are l-values that don't require loading.
+    if (LV.getType()->isFunctionType())
+      return RValue::get(LV.getAddress());
 
     // Everything needs a load.
     return RValue::get(EmitLoadOfScalar(LV));

Added: cfe/trunk/test/CodeGen/PR10204-fun-lvalue.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/PR10204-fun-lvalue.c?rev=133931&view=auto
==============================================================================
--- cfe/trunk/test/CodeGen/PR10204-fun-lvalue.c (added)
+++ cfe/trunk/test/CodeGen/PR10204-fun-lvalue.c Mon Jun 27 14:46:54 2011
@@ -0,0 +1,7 @@
+// RUN: %clang_cc1 -triple i386-unknown-unknown -emit-llvm %s
+// PR10204
+static void loopback_VertexAttribI4ubv() {}
+
+void _mesa_loopback_init_api_table() {
+  (void) loopback_VertexAttribI4ubv;
+}





More information about the cfe-commits mailing list