https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65887

--- Comment #4 from vries at gcc dot gnu.org ---
(In reply to Richard Biener from comment #3)
> (In reply to vries from comment #2)
> Rather than marking the va_list arg addressable in all the cases above
> you should probably simply ensure the frontend marks it so from the
> point it creates a variable with va_list type.  This is because even
> 
>  va_list a1, a2;
>  a1 = a2;
>  __builtin_va_arg (a1, ...);
> 
> might go wrong when gimplifying a1 = a2.
> 

This seems to do the trick, I'll put it through some more testing:
...
diff --git a/gcc/c-family/c-common.c b/gcc/c-family/c-common.c
index 9797e17..d6a93d9 10044
--- a/gcc/c-family/c-common.c
+++ b/gcc/c-family/c-common.c
@@ -5910,6 +5910,7 @@ set_compound_literal_name (tree decl)
 tree
 build_va_arg (location_t loc, tree expr, tree type)
 {
+  mark_addressable (expr);
   expr = build1 (VA_ARG_EXPR, type, expr);
   SET_EXPR_LOCATION (expr, loc);
   return expr;
...

Reply via email to