aboutsummaryrefslogtreecommitdiff
path: root/test/CodeGen/fold-const-declref.c
diff options
context:
space:
mode:
authorEli Friedman <eli.friedman@gmail.com>2010-09-06 00:10:32 +0000
committerEli Friedman <eli.friedman@gmail.com>2010-09-06 00:10:32 +0000
commita7dedf7004e8ac3f947d6817370b2778fa648c2b (patch)
tree9e7ce457c4f053adc6bde2efd180cadf2b251349 /test/CodeGen/fold-const-declref.c
parent6d6370ee10ddcd8cacc44c2d6796800c1325c732 (diff)
PR7242: Make sure to use a different context for evaluating constant
initializers, so the result of the evaluation doesn't leak through inconsistently. Also, don't evaluate references to variables with initializers with side-effects. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@113128 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CodeGen/fold-const-declref.c')
-rw-r--r--test/CodeGen/fold-const-declref.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/test/CodeGen/fold-const-declref.c b/test/CodeGen/fold-const-declref.c
new file mode 100644
index 0000000000..5a7ba8e26a
--- /dev/null
+++ b/test/CodeGen/fold-const-declref.c
@@ -0,0 +1,9 @@
+// RUN: %clang_cc1 -verify -emit-llvm-only
+
+// PR7242: Check that this doesn't crash.
+int main(void)
+{
+ int __negative = 1;
+ const int __max = __negative && 0 ;
+ __max / 0;
+}