This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Fix ICE in match_asm_constraints_1 (PR inline-asm/84941)


On Mon, Mar 19, 2018 at 08:09:00PM +0000, Michael Matz wrote:
> Hi,
> 
> On Mon, 19 Mar 2018, Jakub Jelinek wrote:
> 
> > The inline-asm here has "1p" constraint and we end up with
> > (plus (frame) (const_int ...))
> 
> Blaeh.  Note that "1p" is actually invalid:
> 
> --------------
> `0', `1', `2', ... `9'
>      An operand that matches the specified operand number is allowed.
>      If a digit is used together with letters within the same
>      alternative, the digit should come last.
> --------------
> 
> Changing the order to "p1" would disable the transformation as well, 
> because match_asm_constraints_1() uses strtoul on the constraint start.

Ah, ok, but
  asm volatile ("" : "=m,m" (b), "=r,r" (b) : "1,p" (b));
ICEs the same way, and that should be valid even according to the above
description.

> ... this makes sense.  But I think you're too generous in supporting 
> strange inputs:
> 
> >        if (! REG_P (output)
> >  	  || rtx_equal_p (output, input)
> >  	  || (GET_MODE (input) != VOIDmode
> > -	      && GET_MODE (input) != GET_MODE (output)))
> > +	      && GET_MODE (input) != GET_MODE (output))
> > +	  || !(REG_P (input) || SUBREG_P (input)
> > +	       || MEM_P (input) || CONSTANT_P (input)))
> 
> I'd only allow REG_P (input) as well, not any of the other forms.

I'll try to gather some statistics on what kind of inputs appear there
during bootstrap/regtest and will try to write a few testcases to see
if just || ! REG_P (output) is sufficient or not.

	Jakub


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]