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 PR79908


Hi,

> On Mar 17, 2017, at 6:44 AM, Richard Biener <richard.guenther@gmail.com> wrote:
> 
> No, I was confused in thinking gimplify_expr would handle the case
> properly.  For
> just gimplifying side-effects we should use the middle-end
> gimplification machinery:
> 
> Index: tree-stdarg.c
> ===================================================================
> --- tree-stdarg.c       (revision 246188)
> +++ tree-stdarg.c       (working copy)
> @@ -33,6 +33,7 @@ along with GCC; see the file COPYING3.
> #include "gimple-iterator.h"
> #include "gimple-walk.h"
> #include "gimplify.h"
> +#include "gimplify-me.h"
> #include "tree-into-ssa.h"
> #include "tree-cfg.h"
> #include "tree-stdarg.h"
> @@ -1058,12 +1059,12 @@ expand_ifn_va_arg_1 (function *fun)
>            gimplify_assign (lhs, expr, &pre);
>          }
>        else
> -         gimplify_expr (&expr, &pre, &post, is_gimple_lvalue, fb_lvalue);
> +         force_gimple_operand (expr, &pre, false, NULL_TREE);
> 
>        input_location = saved_location;
>        pop_gimplify_context (NULL);
> 
> -       gimple_seq_add_seq (&pre, post);
> +       gimple_seq_add_seq_without_update (&pre, post);
>        update_modified_stmts (pre);
> 
>        /* Add the sequence after IFN_VA_ARG.  This splits the bb right
> @@ -1072,11 +1073,10 @@ expand_ifn_va_arg_1 (function *fun)
>        gimple_find_sub_bbs (pre, &i);
> 
>        /* Remove the IFN_VA_ARG gimple_call.  It's the last stmt in the
> -          bb.  */
> +          bb if we added any stmts.  */
>        unlink_stmt_vdef (stmt);
>        release_ssa_name_fn (fun, gimple_vdef (stmt));
>        gsi_remove (&i, true);
> -       gcc_assert (gsi_end_p (i));
> 
>        /* We're walking here into the bbs which contain the expansion of
>           IFN_VA_ARG, and will not contain another IFN_VA_ARG that needs

Looks good, but for some reason I hit a segfault in the linker building 
gengtype when I tried to bootstrap with this.  I assume it's something
latent and unrelated, but will need to investigate.

Bill


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