aboutsummaryrefslogtreecommitdiff
path: root/gcc/gimplify.c
diff options
context:
space:
mode:
authorTom de Vries <tom@codesourcery.com>2016-09-10 14:38:56 +0000
committerTom de Vries <vries@gcc.gnu.org>2016-09-10 14:38:56 +0000
commit5b28efbbf4abec11f013f4e76f5b55e2974737cf (patch)
tree3c42070a9bfa92bf3029b74813fd60d1dd925ccc /gcc/gimplify.c
parentaf4b8a523322d6100b52d41ad12d7b602d01331b (diff)
downloadgcc-5b28efbbf4abec11f013f4e76f5b55e2974737cf.zip
gcc-5b28efbbf4abec11f013f4e76f5b55e2974737cf.tar.gz
gcc-5b28efbbf4abec11f013f4e76f5b55e2974737cf.tar.bz2
Make canonical_va_list_type more strict
2016-09-10 Tom de Vries <tom@codesourcery.com> PR C/71602 * builtins.c (std_canonical_va_list_type): Strictly return non-null for va_list type only. * config/i386/i386.c (ix86_canonical_va_list_type): Same. * gimplify.c (gimplify_va_arg_expr): Handle &va_list. * c-common.c (build_va_arg): Handle more strict targetm.canonical_va_list_type. Replace first argument type error with assert. * c-c++-common/va-arg-va-list-type.c: New test. From-SVN: r240072
Diffstat (limited to 'gcc/gimplify.c')
-rw-r--r--gcc/gimplify.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/gcc/gimplify.c b/gcc/gimplify.c
index 2f0dd88..e378ed0 100644
--- a/gcc/gimplify.c
+++ b/gcc/gimplify.c
@@ -11990,6 +11990,11 @@ gimplify_va_arg_expr (tree *expr_p, gimple_seq *pre_p,
if (have_va_type == error_mark_node)
return GS_ERROR;
have_va_type = targetm.canonical_va_list_type (have_va_type);
+ if (have_va_type == NULL_TREE
+ && TREE_CODE (valist) == ADDR_EXPR)
+ /* Handle 'Case 1: Not an array type' from c-common.c/build_va_arg. */
+ have_va_type
+ = targetm.canonical_va_list_type (TREE_TYPE (TREE_TYPE (valist)));
gcc_assert (have_va_type != NULL_TREE);
/* Generate a diagnostic for requesting data of a type that cannot