summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CGExprScalar.cpp
diff options
context:
space:
mode:
authorEli Friedman <eli.friedman@gmail.com>2009-04-20 03:21:44 +0000
committerEli Friedman <eli.friedman@gmail.com>2009-04-20 03:21:44 +0000
commit3253e189c6465fe35fb9059310c478b75f57ff32 (patch)
tree04127cb7ccbb791990cd0a9e0b6ee7a3624429dc /clang/lib/CodeGen/CGExprScalar.cpp
parent23e1f45664f17e32c06146cda92601e5019c95b4 (diff)
downloadbcm5719-llvm-3253e189c6465fe35fb9059310c478b75f57ff32.tar.gz
bcm5719-llvm-3253e189c6465fe35fb9059310c478b75f57ff32.zip
PR3248: Make sure the evaluate the operand of a sizeof when it has a VLA type.
Adapted from patch by Tim Northover. llvm-svn: 69566
Diffstat (limited to 'clang/lib/CodeGen/CGExprScalar.cpp')
-rw-r--r--clang/lib/CodeGen/CGExprScalar.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/clang/lib/CodeGen/CGExprScalar.cpp b/clang/lib/CodeGen/CGExprScalar.cpp
index 98c41e24b6a..0c6e6c6854c 100644
--- a/clang/lib/CodeGen/CGExprScalar.cpp
+++ b/clang/lib/CodeGen/CGExprScalar.cpp
@@ -725,6 +725,10 @@ ScalarExprEmitter::VisitSizeOfAlignOfExpr(const SizeOfAlignOfExpr *E) {
if (E->isArgumentType()) {
// sizeof(type) - make sure to emit the VLA size.
CGF.EmitVLASize(TypeToSize);
+ } else {
+ // C99 6.5.3.4p2: If the argument is an expression of type
+ // VLA, it is evaluated.
+ CGF.EmitAnyExpr(E->getArgumentExpr());
}
return CGF.GetVLASize(VAT);
OpenPOWER on IntegriCloud