From 01f276dac946c0845f6eb3449ab253cfdba841a1 Mon Sep 17 00:00:00 2001 From: Eli Friedman Date: Wed, 25 Jan 2012 23:20:27 +0000 Subject: 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 --- test/CodeGenCXX/c99-variable-length-array.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'test/CodeGenCXX/c99-variable-length-array.cpp') 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 int f(int n) { + T arr[3][n]; + return 3; + } + int test = f(0); +} -- cgit v1.2.3-70-g09d2