On Mon, Apr 27, 2015 at 3:06 PM, Tom de Vries <tom_devr...@mentor.com> wrote: > On 27-04-15 10:17, Richard Biener wrote: >>> >>> This patch fixes that by gimplifying the address expression of the >>> mem-ref >>> >returned by the target hook (borrowing code from gimplify_expr, case >>> >MEM_REF). >>> > >>> >Bootstrapped and reg-tested on x86_64. >>> > >>> >Bootstrapped and reg-tested on hppa2.0w-hp-hpux11.11. >>> > >>> >OK for trunk? >> >> Hmm, that assert looks suspicious... >> >> Can't you simply always do >> >> gimplify_expr (expr, pre_p, post_p, is_gimple_lvalue, fb_lvalue); > > > It's a bit counter-intuitive for me, using is_gimple_lvalue for something > (the result of va_arg) we use as rvalue.
Yeah, choosing that was done because you could assert it's a MEM_REF and tree-stdarg eventually builds a WITH_SIZE_EXPR around it. It would possibly be easier to simply "inline" gimplify_va_arg_internal at its use and only gimplify the assignment. Though in that case the original code probably worked - just in the lhs == NULL case it didn't, which hints at a better place for the fix - in expand_ifn_va_arg_1 do if (lhs != NULL_TREE) { ... } else gimplify_expr (&expr, &pre, &post, is_gimple_val, fb_either); So ... if you can re-try that one it's pre-approved. Thanks, Richard. > But, it seems to work (with & in front of expr). > > OK if bootstrap and reg-test on x86_64 succeeds? > > Thanks, > - Tom >