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 aarch64 ILP32 ICE with vaarg gimplified code


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)


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