summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.c-torture/execute/20051215-1.c
diff options
context:
space:
mode:
authorjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>2005-12-16 12:12:41 +0000
committerjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>2005-12-16 12:12:41 +0000
commit6a1c0b169b7cc2bc41657dd60499c4dafd626c5d (patch)
treeac8e1c720ac8e73c2f5c6adefd286fbc5483c5be /gcc/testsuite/gcc.c-torture/execute/20051215-1.c
parent302756144171389c075e94130b821c357f2e81de (diff)
downloadgcc-6a1c0b169b7cc2bc41657dd60499c4dafd626c5d.tar.gz
PR rtl-optimization/24899
* loop.c (strength_reduce): Don't reduce giv that is not always computable and where add_val or mult_val can trap. * gcc.c-torture/execute/20051215-1.c: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@108642 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/testsuite/gcc.c-torture/execute/20051215-1.c')
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/20051215-1.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.c-torture/execute/20051215-1.c b/gcc/testsuite/gcc.c-torture/execute/20051215-1.c
new file mode 100644
index 00000000000..143a449d080
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/execute/20051215-1.c
@@ -0,0 +1,28 @@
+/* PR rtl-optimization/24899 */
+
+extern void abort (void);
+
+__attribute__ ((noinline)) int
+foo (int x, int y, int *z)
+{
+ int a, b, c, d;
+
+ a = b = 0;
+ for (d = 0; d < y; d++)
+ {
+ if (z)
+ b = d * *z;
+ for (c = 0; c < x; c++)
+ a += b;
+ }
+
+ return a;
+}
+
+int
+main (void)
+{
+ if (foo (3, 2, 0) != 0)
+ abort ();
+ return 0;
+}