aboutsummaryrefslogtreecommitdiff
path: root/SingleSource/Regression/C/gcc-c-torture/execute/pr24141.c
diff options
context:
space:
mode:
Diffstat (limited to 'SingleSource/Regression/C/gcc-c-torture/execute/pr24141.c')
-rw-r--r--SingleSource/Regression/C/gcc-c-torture/execute/pr24141.c33
1 files changed, 33 insertions, 0 deletions
diff --git a/SingleSource/Regression/C/gcc-c-torture/execute/pr24141.c b/SingleSource/Regression/C/gcc-c-torture/execute/pr24141.c
new file mode 100644
index 00000000..30129620
--- /dev/null
+++ b/SingleSource/Regression/C/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;
+}