From 0b1fbd139418d1afbe10cf60a9a85a3cc090aa56 Mon Sep 17 00:00:00 2001 From: Eli Friedman Date: Mon, 6 Sep 2010 00:10:32 +0000 Subject: 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. llvm-svn: 113128 --- clang/test/CodeGen/fold-const-declref.c | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 clang/test/CodeGen/fold-const-declref.c (limited to 'clang/test/CodeGen') diff --git a/clang/test/CodeGen/fold-const-declref.c b/clang/test/CodeGen/fold-const-declref.c new file mode 100644 index 00000000000..5a7ba8e26a7 --- /dev/null +++ b/clang/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; +} -- cgit v1.2.3