Index: c-parser.c =================================================================== --- c-parser.c (revision 231206) +++ c-parser.c (working copy) @@ -7485,7 +7485,7 @@ c_parser_postfix_expression (c_parser *p else { tree type_expr = NULL_TREE; - expr.value = c_build_va_arg (loc, e1.value, + expr.value = c_build_va_arg (start_loc, e1.value, loc, groktypename (t1, &type_expr, NULL)); if (type_expr) { Index: c-tree.h =================================================================== --- c-tree.h (revision 231206) +++ c-tree.h (working copy) @@ -661,7 +661,7 @@ extern tree c_finish_omp_task (location_ extern void c_finish_omp_cancel (location_t, tree); extern void c_finish_omp_cancellation_point (location_t, tree); extern tree c_finish_omp_clauses (tree, bool, bool = false); -extern tree c_build_va_arg (location_t, tree, tree); +extern tree c_build_va_arg (location_t, tree, location_t, tree); extern tree c_finish_transaction (location_t, tree, int); extern bool c_tree_equal (tree, tree); extern tree c_build_function_call_vec (location_t, vec, tree, Index: c-typeck.c =================================================================== --- c-typeck.c (revision 231206) +++ c-typeck.c (working copy) @@ -13426,20 +13426,28 @@ c_build_qualified_type (tree type, int t /* Build a VA_ARG_EXPR for the C parser. */ tree -c_build_va_arg (location_t loc, tree expr, tree type) +c_build_va_arg (location_t loc1, tree expr, location_t loc2, tree type) { if (error_operand_p (type)) return error_mark_node; + /* VA_ARG_EXPR cannot be used for a scalar va_list with reverse storage + order because it takes the address of the expression. */ + else if (handled_component_p (expr) + && reverse_storage_order_for_component_p (expr)) + { + error_at (loc1, "cannot use % with reverse storage order"); + return error_mark_node; + } else if (!COMPLETE_TYPE_P (type)) { - error_at (loc, "second argument to % is of incomplete " + error_at (loc2, "second argument to % is of incomplete " "type %qT", type); return error_mark_node; } else if (warn_cxx_compat && TREE_CODE (type) == ENUMERAL_TYPE) - warning_at (loc, OPT_Wc___compat, + warning_at (loc2, OPT_Wc___compat, "C++ requires promoted type, not enum type, in %"); - return build_va_arg (loc, expr, type); + return build_va_arg (loc2, expr, type); } /* Return truthvalue of whether T1 is the same tree structure as T2.