summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.c-torture/execute/loop-10.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/gcc.c-torture/execute/loop-10.c')
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/loop-10.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.c-torture/execute/loop-10.c b/gcc/testsuite/gcc.c-torture/execute/loop-10.c
new file mode 100644
index 000000000..1a6afba6b
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/execute/loop-10.c
@@ -0,0 +1,31 @@
+/* Reduced from PR optimization/5076, PR optimization/2847 */
+
+static int count = 0;
+
+static void
+inc (void)
+{
+ count++;
+}
+
+int
+main (void)
+{
+ int iNbr = 1;
+ int test = 0;
+ while (test == 0)
+ {
+ inc ();
+ if (iNbr == 0)
+ break;
+ else
+ {
+ inc ();
+ iNbr--;
+ }
+ test = 1;
+ }
+ if (count != 2)
+ abort ();
+ return 0;
+}