------- Comment #7 from ebotcazou at gcc dot gnu dot org  2010-01-13 10:03 
-------
> This patch fixes the bug.
> Do you think if this patch is favorable? If yes, I will do dejagnu
> test and send it to gcc-patches for review.

The patch is probably correct, but I'd ditch hunks #1 and #3.  In case1, the
code already sets a flag (i3_subst_into_i2) so we're better off not setting
another one, lest it badly interacts with the former.  Moreover, even if the
pattern is not valid, the dest of I3 has nevertheless changed.

So hunk #2 alone is sufficient, but the comment isn't quite up to the point. 
I'd copy and adapt for case2 the comment of case1 instead:

              /* Replace the dest in I2 with our dest and make the resulting
                 insn the new pattern for I3.  Then skip to where we
                 validate the pattern.  Everything was set up above.  */

as well as update the comment at the destination:

  /* We come here when we are replacing a destination in I2 with the
     destination of I3.  */
 validate_replacement:

which was written for case1 and obviously overlooks case2.

You reported the problem against 4.4.x as well and I think the patch would be
safe enough as to be put on the branch, but formally the bug needs to be a
regression from earlier compilers.  Do you know of such a compiler, e.g. 4.3.x,
which correctly compiles your testcase for the same target and with the same
options?


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42691

Reply via email to