This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Fix alias.c ICE on inline-asm "=m" incomplete operand (PR inline-asm/85022)
- From: Jakub Jelinek <jakub at redhat dot com>
- To: Richard Biener <rguenther at suse dot de>
- Cc: Jeff Law <law at redhat dot com>, gcc-patches at gcc dot gnu dot org
- Date: Fri, 23 Mar 2018 10:04:56 +0100
- Subject: Re: [PATCH] Fix alias.c ICE on inline-asm "=m" incomplete operand (PR inline-asm/85022)
- References: <20180322213406.GX8577@tucnak> <alpine.LSU.2.20.1803230952120.18265@zhemvz.fhfr.qr>
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
On Fri, Mar 23, 2018 at 09:53:53AM +0100, Richard Biener wrote:
> > Something I wasn't really aware, apparently we allow extern vars with
> > incomplete types in "m" and "=m" constrained asm. The problem is that
> > incomplete vars have VOIDmode mode and so their MEMs do as well, apparently
> > everything works with it except a 2013-ish assert in alias.c.
> >
> > The following patch just makes sure x_mode is not VOIDmode if x doesn't have
> > VOIDmode, if x has VOIDmode, then it is fine for x_mode to be VOIDmode too.
> >
> > Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?
>
> OK.
>
> The question now is whether we handle dependences correctly for
> VOIDmode MEMs? Do they have !MEM_SIZE_KNOWN_P?
They have MEM_SIZE_KNOWN_P true unfortunately.
set_mem_attributes_minus_bitpos starts with:
defattrs = mode_mem_attrs[(int) GET_MODE (ref)];
gcc_assert (!defattrs->expr);
gcc_assert (!defattrs->offset_known_p);
/* Respect mode size. */
attrs.size_known_p = defattrs->size_known_p;
attrs.size = defattrs->size;
and because both TYPE_SIZE_UNIT and DECL_SIZE_UNIT are NULL, nothing updates
the size_known_p.
Wonder if we just shouldn't make mode_mem_attrs[VOIDmode]->size_known_p
false and mode_mem_attrs[VOIDmode]->size NULL, like we do for BLKmode?
for (i = 0; i < (int) MAX_MACHINE_MODE; i++)
{
mode = (machine_mode) i;
attrs = ggc_cleared_alloc<mem_attrs> ();
attrs->align = BITS_PER_UNIT;
attrs->addrspace = ADDR_SPACE_GENERIC;
- if (mode != BLKmode)
+ if (mode != BLKmode && mode != VOIDmode)
{
attrs->size_known_p = true;
attrs->size = GET_MODE_SIZE (mode);
if (STRICT_ALIGNMENT)
attrs->align = GET_MODE_ALIGNMENT (mode);
}
?
Jakub