summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.c-torture/execute/pr40747.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/gcc.c-torture/execute/pr40747.c')
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/pr40747.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.c-torture/execute/pr40747.c b/gcc/testsuite/gcc.c-torture/execute/pr40747.c
new file mode 100644
index 00000000000..1c75be3fcc5
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/execute/pr40747.c
@@ -0,0 +1,22 @@
+/* PR middle-end/40747 */
+
+extern void abort (void);
+
+int
+foo (int i)
+{
+ return (i < 4 && i >= 0) ? i : 4;
+}
+
+int
+main ()
+{
+ if (foo (-1) != 4) abort ();
+ if (foo (0) != 0) abort ();
+ if (foo (1) != 1) abort ();
+ if (foo (2) != 2) abort ();
+ if (foo (3) != 3) abort ();
+ if (foo (4) != 4) abort ();
+ if (foo (5) != 4) abort ();
+ return 0;
+}