summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.c-torture/execute/pr24141.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/gcc.c-torture/execute/pr24141.c')
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/pr24141.c33
1 files changed, 33 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.c-torture/execute/pr24141.c b/gcc/testsuite/gcc.c-torture/execute/pr24141.c
new file mode 100644
index 000000000..301296206
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/execute/pr24141.c
@@ -0,0 +1,33 @@
+// reduced testcase, compile with -O2. Also, with --disable-checking
+// gcc produces wrong code.
+
+void abort (void);
+int i;
+
+void g (void)
+{
+ i = 1;
+}
+
+void f (int a, int b)
+{
+ int c = 0;
+ if (a == 0)
+ c = 1;
+ if (c)
+ return;
+ if (c == 1)
+ c = 0;
+ if (b == 0)
+ c = 1;
+ if (c)
+ g ();
+}
+
+int main (void)
+{
+ f (1, 0);
+ if (i != 1)
+ abort ();
+ return 0;
+}