summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/loop-2.c
diff options
context:
space:
mode:
authorjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>2003-03-25 20:24:42 +0000
committerjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>2003-03-25 20:24:42 +0000
commita82119e49ef3ab1cca3e6b472878d8ffc4b7b724 (patch)
treec48ce8d00c0de5784247bb6050aa914358fd8591 /gcc/testsuite/gcc.dg/loop-2.c
parent91bee29ee2fe5ec100e78cb677747756e5b3c0bd (diff)
downloadgcc-a82119e49ef3ab1cca3e6b472878d8ffc4b7b724.tar.gz
PR optimization/10171
* unroll.c (unroll_loop): Don't delete the jump at the end unless we also delete a jump at the beginning. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@64863 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/testsuite/gcc.dg/loop-2.c')
-rw-r--r--gcc/testsuite/gcc.dg/loop-2.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/loop-2.c b/gcc/testsuite/gcc.dg/loop-2.c
new file mode 100644
index 00000000000..e939f327bac
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/loop-2.c
@@ -0,0 +1,20 @@
+/* PR optimization/10171 */
+/* Bug: unroll_loop misoptimized the function so that we got
+ 0 iterations of the loop rather than the correct 1. */
+/* { dg-do run } */
+
+inline int tag() { return 0; }
+
+void f ();
+
+int main() {
+ int i;
+ for (i = 0; i < (tag() ? 2 : 1); i++)
+ f();
+ abort ();
+}
+
+void f ()
+{
+ exit (0);
+}