Problem with std_expand_builtin_va_start on targets where sizetype and ptr_type_node don't have the same mode

Zack Weinberg zackw@panix.com
Fri Jul 6 15:41:00 GMT 2007


On 05 Jul 2007 18:22:50 -0700, Ian Lance Taylor <iant@google.com> wrote:
> "Zack Weinberg" <zackw@panix.com> writes:
>
> [std_expand_builtin_va_start]
>
> >   rtx va_r = expand_normal (valist);
> >   emit_move_insn (va_r, nextarg);
> >
> > but this is a part of the compiler I am not at all familiar with...
>
> I think you would want something more like
>     rtx va_r = expand_expr (valist, NULL_RTX, VOIDmode, EXPAND_WRITE);
>     convert_move (va_r, nextarg, 0);

No regressions on arm-elf (simulator, default and -mthumb); in fact,
execute/20040709-1.c stops ICEing at -O3 -fomit-frame-pointer, but I
think this is spurious, as that test has no variadic functions in it.
OK to commit?

zw

2007-07-06  Ian Lance Taylor <iant@google.com>
             Zack Weinberg <zackw@panix.com>

        PR 32441
        * builtins.c (std_expand_builtin_va_start): Don't use make_tree.

==================================================================
--- builtins.c  (revision 126344)
+++ builtins.c  (local)
@@ -4649,14 +4649,8 @@ std_build_builtin_va_list (void)
 void
 std_expand_builtin_va_start (tree valist, rtx nextarg)
 {
-  tree t;
-  t = make_tree (sizetype, nextarg);
-  t = fold_convert (ptr_type_node, t);
-
-  t = build2 (MODIFY_EXPR, TREE_TYPE (valist), valist, t);
-  TREE_SIDE_EFFECTS (t) = 1;
-
-  expand_expr (t, const0_rtx, VOIDmode, EXPAND_NORMAL);
+  rtx va_r = expand_expr (valist, NULL_RTX, VOIDmode, EXPAND_WRITE);
+  convert_move (va_r, nextarg, 0);
 }

 /* Expand EXP, a call to __builtin_va_start.  */



More information about the Gcc mailing list