------- Additional Comments From aoliva at gcc dot gnu dot org 2005-03-30 19:28 ------- Subject: Re: [PR middle-end/20491] combine generates bad subregs
On Mar 29, 2005, Alexandre Oliva <[EMAIL PROTECTED]> wrote: > On Mar 28, 2005, Richard Henderson <[EMAIL PROTECTED]> wrote: >> On Thu, Mar 24, 2005 at 07:45:44AM -0300, Alexandre Oliva wrote: >>> * combine.c (subst): Make sure we don't create invalid subregs. >> Ok. > As it turned out, the bug seems to have been fixed by some other > patch, because I no longer get the error in mainline or in the 4.0 > branch. Or perhaps it never actually failed on x86_64-linux-gnu, which is where I was trying to trigger it again. Not even with -m32. A build on i686-pc-linux-gnu was enough to trigger it. Yay me! :-) So, the patch posted in my previous e-mail still stands, but if you, like me, find that it's working too hard to avoid such subregs, here's an alternative patch that also fixes the problem, at least as long as the X-constrained asm operand is not actually used in the asm output pattern. Index: gcc/ChangeLog from Alexandre Oliva <[EMAIL PROTECTED]> PR middle-end/20491 * final.c (alter_subreg): Don't call subreg_regno for a non-REG. Index: gcc/final.c =================================================================== RCS file: /cvs/gcc/gcc/gcc/final.c,v retrieving revision 1.344.12.1 diff -u -p -r1.344.12.1 final.c --- gcc/final.c 22 Mar 2005 13:39:12 -0000 1.344.12.1 +++ gcc/final.c 30 Mar 2005 19:21:02 -0000 @@ -1,6 +1,7 @@ /* Convert RTL to assembler code and output it, for GNU compiler. Copyright (C) 1987, 1988, 1989, 1992, 1993, 1994, 1995, 1996, 1997, - 1998, 1999, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. + 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 + Free Software Foundation, Inc. This file is part of GCC. @@ -2638,7 +2639,7 @@ alter_subreg (rtx *xp) if (new != 0) *xp = new; - else + else if (REG_P (y)) { /* Simplify_subreg can't handle some REG cases, but we have to. */ unsigned int regno = subreg_regno (x); -- Alexandre Oliva http://www.ic.unicamp.br/~oliva/ Red Hat Compiler Engineer [EMAIL PROTECTED], gcc.gnu.org} Free Software Evangelist [EMAIL PROTECTED], gnu.org} -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20491