diff options
author | Nico Weber <nicolasweber@gmx.de> | 2011-06-27 19:46:54 +0000 |
---|---|---|
committer | Nico Weber <nicolasweber@gmx.de> | 2011-06-27 19:46:54 +0000 |
commit | 9d11e6f4754848cd74b9a08d40d4a9e0fe68e29d (patch) | |
tree | d2d3211c473b32fa3accb3de1b78511a0a63af57 | |
parent | 064c44b8a17d4c426b87ad1c58de81d76a13fca3 (diff) |
Revert parts of r133860 to fix a crash. Add a test.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133931 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/CodeGen/CGExpr.cpp | 4 | ||||
-rw-r--r-- | test/CodeGen/PR10204-fun-lvalue.c | 7 |
2 files changed, 10 insertions, 1 deletions
diff --git a/lib/CodeGen/CGExpr.cpp b/lib/CodeGen/CGExpr.cpp index a3f8301578..5bdb016738 100644 --- a/lib/CodeGen/CGExpr.cpp +++ b/lib/CodeGen/CGExpr.cpp @@ -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 index 0000000000..ff558f18c5 --- /dev/null +++ b/test/CodeGen/PR10204-fun-lvalue.c @@ -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; +} |