aboutsummaryrefslogtreecommitdiff
path: root/test/CodeGenCXX/c99-variable-length-array.cpp
diff options
context:
space:
mode:
authorEli Friedman <eli.friedman@gmail.com>2012-01-25 23:20:27 +0000
committerEli Friedman <eli.friedman@gmail.com>2012-01-25 23:20:27 +0000
commit01f276dac946c0845f6eb3449ab253cfdba841a1 (patch)
tree48af6c09294b41d23c688344b2f1bf145dac8c9d /test/CodeGenCXX/c99-variable-length-array.cpp
parent10afce37c6944acf1018138ef74ab69451d3aea6 (diff)
Don't stack-allocate an IntegerLiteral which can be referred to after the current method returns. PR11744, part 2.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148995 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CodeGenCXX/c99-variable-length-array.cpp')
-rw-r--r--test/CodeGenCXX/c99-variable-length-array.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/test/CodeGenCXX/c99-variable-length-array.cpp b/test/CodeGenCXX/c99-variable-length-array.cpp
index 76f99c7b41..d486f9b018 100644
--- a/test/CodeGenCXX/c99-variable-length-array.cpp
+++ b/test/CodeGenCXX/c99-variable-length-array.cpp
@@ -25,3 +25,13 @@ void f(int argc, const char* argv[]) {
// CHECK: call void @_ZN1XD1Ev
// CHECK: ret void
}
+
+namespace PR11744 {
+ // Make sure this doesn't crash; there was a use-after-free issue
+ // for this testcase.
+ template<typename T> int f(int n) {
+ T arr[3][n];
+ return 3;
+ }
+ int test = f<int>(0);
+}