This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Fix ICE with asm "m" (stmt-expr) operand (PR middle-end/67653)
- From: Jakub Jelinek <jakub at redhat dot com>
- To: Richard Biener <rguenther at suse dot de>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Tue, 19 Jan 2016 14:33:04 +0100
- Subject: Re: [PATCH] Fix ICE with asm "m" (stmt-expr) operand (PR middle-end/67653)
- Authentication-results: sourceware.org; auth=none
- References: <20160118231114 dot GD3017 at tucnak dot redhat dot com> <alpine dot LSU dot 2 dot 11 dot 1601190958370 dot 31122 at t29 dot fhfr dot qr>
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
On Tue, Jan 19, 2016 at 10:00:00AM +0100, Richard Biener wrote:
> On Tue, 19 Jan 2016, Jakub Jelinek wrote:
> > Here is an attempt to fix ICE on statement expression in "m" asm input
> > operand. The problem is that gimplify_asm_expr attempts to mark it
> > addressable, but that can be just too late, a temporary the stmt-expression
> > gimplifies to might not be addressable and may be used already in the
> > gimplified code. Normally the C/C++ FEs attempt to mark the operand
> > addressable already, but in case of statement expression the temporaries
> > might not exist yet.
> > The patch turns also the PR29119 testcase into invalid test, but you've
> > already said in that PR it should be invalid and I agree with that.
>
> Hmm, but can't we detect this in the FE?
We could diagnose a statement expression in "m", but not sure if that is all
that can get wrong, or if all statement expressions are problematic.
> > Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?
>
> What happens if we just do _not_ mark the memory input addressable?
> Shouldn't IRA/LRA in the end satisfy the constraint by spilling
> a non-memory input and using the spill slot?
Well, if you want to make broken testcases work, it is always possible
to call say prepare_gimple_addressable, but I'd think it is preferrable
to tell people that what they do is really going to do something different
from what they expect (that the operand, while being a memory input, will
be some temporary containing a copy of the value rather than than the
variable itself.
Jakub