This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Fix aarch64 ILP32 ICE with vaarg gimplified code
- From: Richard Biener <rguenther at suse dot de>
- To: Christophe Lyon <christophe dot lyon at linaro dot org>
- Cc: gcc Patches <gcc-patches at gcc dot gnu dot org>, Richard Earnshaw <richard dot earnshaw at arm dot com>, James Greenhalgh <james dot greenhalgh at arm dot com>, Marcus Shawcroft <marcus dot shawcroft at arm dot com>
- Date: Thu, 26 Apr 2018 15:41:06 +0200 (CEST)
- Subject: Re: [PATCH] Fix aarch64 ILP32 ICE with vaarg gimplified code
- References: <alpine.LSU.2.20.1804261407240.24704@zhemvz.fhfr.qr> <CAKdteObn-9xk9LvFM0KU=g1L8mbdoOaK9aCPimH8ZhevcvYvqQ@mail.gmail.com>
On Thu, 26 Apr 2018, Christophe Lyon wrote:
> On 26 April 2018 at 14:09, Richard Biener <rguenther@suse.de> wrote:
> >
> > Seen by Christophe Lyon, verified with a cross that this fixes the
> > issue.
> >
> > aarch64 people, can you please test & commit this?
> >
>
> As I have just written in bugzilla, this patch avoids an ICE when
> compiling newlib's sysopen.i,
> but I still see a similar crash when compiling vfprintf.i.
There's a similar case still left. Complete patch:
Index: gcc/config/aarch64/aarch64.c
===================================================================
--- gcc/config/aarch64/aarch64.c (revision 259669)
+++ gcc/config/aarch64/aarch64.c (working copy)
@@ -12267,23 +12267,17 @@ aarch64_gimplify_va_arg_expr (tree valis
if (align > 8)
{
/* if (alignof(type) > 8) (arg = arg + 15) & -16; */
- t = fold_convert (intDI_type_node, arg);
- t = build2 (PLUS_EXPR, TREE_TYPE (t), t,
- build_int_cst (TREE_TYPE (t), 15));
+ t = fold_build_pointer_plus_hwi (arg, 15);
t = build2 (BIT_AND_EXPR, TREE_TYPE (t), t,
build_int_cst (TREE_TYPE (t), -16));
- t = fold_convert (TREE_TYPE (arg), t);
roundup = build2 (MODIFY_EXPR, TREE_TYPE (arg), arg, t);
}
else
roundup = NULL;
/* Advance ap.__stack */
- t = fold_convert (intDI_type_node, arg);
- t = build2 (PLUS_EXPR, TREE_TYPE (t), t,
- build_int_cst (TREE_TYPE (t), size + 7));
+ t = fold_build_pointer_plus_hwi (arg, size + 7);
t = build2 (BIT_AND_EXPR, TREE_TYPE (t), t,
build_int_cst (TREE_TYPE (t), -8));
- t = fold_convert (TREE_TYPE (arg), t);
t = build2 (MODIFY_EXPR, TREE_TYPE (stack), unshare_expr (stack), t);
/* String up roundup and advance. */
if (roundup)
> Thanks,
>
> Christophe
>
> > Thanks,
> > Richard.
> >
> > 2018-04-26 Richard Biener <rguenther@suse.de>
> >
> > * config/aarch64/aarch64.c: Simplify ap.__stack advance and
> > fix for ILP32.
> >
> > Index: gcc/config/aarch64/aarch64.c
> > ===================================================================
> > --- gcc/config/aarch64/aarch64.c (revision 259669)
> > +++ gcc/config/aarch64/aarch64.c (working copy)
> > @@ -12278,12 +12278,9 @@ aarch64_gimplify_va_arg_expr (tree valis
> > else
> > roundup = NULL;
> > /* Advance ap.__stack */
> > - t = fold_convert (intDI_type_node, arg);
> > - t = build2 (PLUS_EXPR, TREE_TYPE (t), t,
> > - build_int_cst (TREE_TYPE (t), size + 7));
> > + t = fold_build_pointer_plus_hwi (arg, size + 7);
> > t = build2 (BIT_AND_EXPR, TREE_TYPE (t), t,
> > build_int_cst (TREE_TYPE (t), -8));
> > - t = fold_convert (TREE_TYPE (arg), t);
> > t = build2 (MODIFY_EXPR, TREE_TYPE (stack), unshare_expr (stack), t);
> > /* String up roundup and advance. */
> > if (roundup)
>
>
--
Richard Biener <rguenther@suse.de>
SUSE LINUX GmbH, GF: Felix Imendoerffer, Jane Smithard, Graham Norton, HRB 21284 (AG Nuernberg)