aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorRoger Sayle <roger@eyesopen.com>2003-12-12 14:31:18 +0000
committerRoger Sayle <sayle@gcc.gnu.org>2003-12-12 14:31:18 +0000
commit77fec971c15551081d6eccb41275dd1c4e10e73c (patch)
treea1a513e215c058b87308a64dad0cf5d62797e70d /gcc
parent90d46c28f20ebc52d770c179d39bb429a0a6f55a (diff)
downloadgcc-77fec971c15551081d6eccb41275dd1c4e10e73c.zip
gcc-77fec971c15551081d6eccb41275dd1c4e10e73c.tar.gz
gcc-77fec971c15551081d6eccb41275dd1c4e10e73c.tar.bz2
re PR rtl-optimization/13037 ([gcse-lm] g77 generates incorrect code)
PR optimization/13037 * loop.c (update_giv_derive): Ignore redundant sets of a biv when calculating how to derive a giv from a biv. * g77.f-torture/execute/13037.f: New test case. From-SVN: r74572
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/loop.c4
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/g77.f-torture/execute/13037.f58
4 files changed, 73 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index ad91bf6..56fb00f 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,9 @@
+2003-12-12 Roger Sayle <roger@eyesopen.com>
+
+ PR optimization/13037
+ * loop.c (update_giv_derive): Ignore redundant sets of a biv when
+ calculating how to derive a giv from a biv.
+
2003-12-12 Neil Booth <neil@daikokuya.co.uk>
PR preprocessor/12935 preprocessor/12952 preprocessor/13046
diff --git a/gcc/loop.c b/gcc/loop.c
index e1e85e8..8deb398 100644
--- a/gcc/loop.c
+++ b/gcc/loop.c
@@ -6095,6 +6095,10 @@ update_giv_derive (const struct loop *loop, rtx p)
if (GET_CODE (p) == CODE_LABEL || GET_CODE (p) == JUMP_INSN
|| biv->insn == p)
{
+ /* Skip if location is the same as a previous one. */
+ if (biv->same)
+ continue;
+
for (giv = bl->giv; giv; giv = giv->next_iv)
{
/* If cant_derive is already true, there is no point in
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index eee3f58..f206b50 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2003-12-12 Roger Sayle <roger@eyesopen.com>
+
+ PR optimization/13037
+ * g77.f-torture/execute/13037.f: New test case.
+
2003-12-12 Nathan Sidwell <nathan@codesourcery.com>
PR c++/12881
diff --git a/gcc/testsuite/g77.f-torture/execute/13037.f b/gcc/testsuite/g77.f-torture/execute/13037.f
new file mode 100644
index 0000000..daafc52
--- /dev/null
+++ b/gcc/testsuite/g77.f-torture/execute/13037.f
@@ -0,0 +1,58 @@
+c PR optimization/13037
+c Contributed by Kirill Smelkov
+c bug symptom: zeta(kkzc) seems to reference to zeta(kkzc-1) instead
+c with gcc-3.2.2 it is OK, so it is a regression.
+c
+ subroutine bug1(expnt)
+ implicit none
+
+ double precision zeta
+ common /bug1_area/zeta(3)
+
+ double precision expnt(3)
+
+
+ integer k, kkzc
+
+ kkzc=0
+ do k=1,3
+ kkzc = kkzc + 1
+ zeta(kkzc) = expnt(k)
+ enddo
+
+c the following line activates the bug
+ call bug1_activator(kkzc)
+ end
+
+
+c dummy subroutine
+ subroutine bug1_activator(inum)
+ implicit none
+ integer inum
+ end
+
+
+c test driver
+ program test_bug1
+ implicit none
+
+ double precision zeta
+ common /bug1_area/zeta(3)
+
+ double precision expnt(3)
+
+ zeta(1) = 0.0d0
+ zeta(2) = 0.0d0
+ zeta(3) = 0.0d0
+
+ expnt(1) = 1.0d0
+ expnt(2) = 2.0d0
+ expnt(3) = 3.0d0
+
+ call bug1(expnt)
+ if ((zeta(1).ne.1) .or. (zeta(2).ne.2) .or. (zeta(3).ne.3)) then
+ call abort
+ endif
+
+ end
+