PR optimization/13060
authorebotcazou <ebotcazou@138bc75d-0d04-0410-961f-82ee72b054a4>
Sun, 7 Dec 2003 12:51:58 +0000 (12:51 +0000)
committerebotcazou <ebotcazou@138bc75d-0d04-0410-961f-82ee72b054a4>
Sun, 7 Dec 2003 12:51:58 +0000 (12:51 +0000)
* function.c (fixup_var_refs_1) [SUBREG]: Recognize even if a
replacement already exists.  Fix again the whole insn if that fails.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@74386 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/function.c
gcc/testsuite/ChangeLog
gcc/testsuite/g77.f-torture/compile/13060.f [new file with mode: 0644]

index 7343b32..c37ec9b 100644 (file)
@@ -1,3 +1,9 @@
+2003-12-07  Eric Botcazou  <ebotcazou@libertysurf.fr>
+
+       PR optimization/13060
+       * function.c (fixup_var_refs_1) [SUBREG]: Recognize even if a
+       replacement already exists.  Fix again the whole insn if that fails.
+
 2003-12-06  Andrew Pinski  <pinskia@physics.uc.edu>
 
        * config/rs6000/rs6000.c (macho_branch_islands): Use 
index 2a8f30b..ed73315 100644 (file)
@@ -2092,7 +2092,23 @@ fixup_var_refs_1 (rtx var, enum machine_mode promoted_mode, rtx *loc, rtx insn,
          replacement = find_fixup_replacement (replacements, x);
          if (replacement->new)
            {
+             enum machine_mode mode = GET_MODE (x);
              *loc = replacement->new;
+
+             /* Careful!  We may have just replaced a SUBREG by a MEM, which
+                means that the insn may have become invalid again.  We can't
+                in this case make a new replacement since we already have one
+                and we must deal with MATCH_DUPs.  */
+             if (GET_CODE (replacement->new) == MEM)
+               {
+                 INSN_CODE (insn) = -1;
+                 if (recog_memoized (insn) >= 0)
+                   return;
+
+                 fixup_var_refs_1 (replacement->new, mode, &PATTERN (insn),
+                                   insn, replacements, no_share);
+               }
+
              return;
            }
 
index d65ed73..3e1be98 100644 (file)
@@ -1,3 +1,7 @@
+2003-12-07  Eric Botcazou  <ebotcazou@libertysurf.fr>
+
+       * g77.f-torture/compile/13060.f: New test.
+
 2003-12-06  Mark Mitchell  <mark@codesourcery.com>
 
        PR c++/13323
diff --git a/gcc/testsuite/g77.f-torture/compile/13060.f b/gcc/testsuite/g77.f-torture/compile/13060.f
new file mode 100644 (file)
index 0000000..200117b
--- /dev/null
@@ -0,0 +1,13 @@
+      subroutine geo2()
+      implicit none
+
+      integer ms,n,ne(2)
+
+      ne(1) = 1
+      ne(2) = 2
+      ms = 1
+
+      call call_me(ne(1)*ne(1))
+
+      n = ne(ms)
+      end