This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Fix ICE in match_asm_constraints_1 (PR inline-asm/84941)
- From: Jakub Jelinek <jakub at redhat dot com>
- To: Michael Matz <matz at suse dot de>
- Cc: Richard Biener <rguenther at suse dot de>, Jeff Law <law at redhat dot com>, gcc-patches at gcc dot gnu dot org
- Date: Mon, 19 Mar 2018 21:21:35 +0100
- Subject: Re: [PATCH] Fix ICE in match_asm_constraints_1 (PR inline-asm/84941)
- References: <20180319194539.GQ8577@tucnak> <alpine.LSU.2.21.1803191959050.5310@wotan.suse.de>
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
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