]> granicus.if.org Git - clang/commitdiff
Revert parts of r133860 to fix a crash. Add a test.
authorNico Weber <nicolasweber@gmx.de>
Mon, 27 Jun 2011 19:46:54 +0000 (19:46 +0000)
committerNico Weber <nicolasweber@gmx.de>
Mon, 27 Jun 2011 19:46:54 +0000 (19:46 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133931 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/CGExpr.cpp
test/CodeGen/PR10204-fun-lvalue.c [new file with mode: 0644]

index a3f8301578fdd4c350484d721d26463225237202..5bdb016738bfdc8e8bd7b71971f5dab480216095 100644 (file)
@@ -791,7 +791,9 @@ RValue CodeGenFunction::EmitLoadOfLValue(LValue LV) {
     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));
diff --git a/test/CodeGen/PR10204-fun-lvalue.c b/test/CodeGen/PR10204-fun-lvalue.c
new file mode 100644 (file)
index 0000000..ff558f1
--- /dev/null
@@ -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;
+}