diff options
author | mpolacek <mpolacek@138bc75d-0d04-0410-961f-82ee72b054a4> | 2016-04-15 13:15:23 +0000 |
---|---|---|
committer | mpolacek <mpolacek@138bc75d-0d04-0410-961f-82ee72b054a4> | 2016-04-15 13:15:23 +0000 |
commit | 926f9422390be1e7f91bce9a23f39e246aad4907 (patch) | |
tree | 061774906bbfa0c5be9e741fd1174ca837aed154 /gcc/c-family/c-common.c | |
parent | c970b33debc7e79b64af1d41a37c466979776695 (diff) | |
download | gcc-926f9422390be1e7f91bce9a23f39e246aad4907.tar.gz |
PR c/70651
* c-common.c (build_va_arg): Change two asserts into errors and return
error_mark_node.
* c-c++-common/pr70651.c: New test.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@235027 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/c-family/c-common.c')
-rw-r--r-- | gcc/c-family/c-common.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/gcc/c-family/c-common.c b/gcc/c-family/c-common.c index 30c815d5381..f2846bb26e7 100644 --- a/gcc/c-family/c-common.c +++ b/gcc/c-family/c-common.c @@ -5725,7 +5725,12 @@ build_va_arg (location_t loc, tree expr, tree type) /* Verify that &ap is still recognized as having va_list type. */ tree canon_expr_type = targetm.canonical_va_list_type (TREE_TYPE (expr)); - gcc_assert (canon_expr_type != NULL_TREE); + if (canon_expr_type == NULL_TREE) + { + error_at (loc, + "first argument to %<va_arg%> not of type %<va_list%>"); + return error_mark_node; + } return build_va_arg_1 (loc, type, expr); } @@ -5793,7 +5798,12 @@ build_va_arg (location_t loc, tree expr, tree type) /* Verify that &ap is still recognized as having va_list type. */ tree canon_expr_type = targetm.canonical_va_list_type (TREE_TYPE (expr)); - gcc_assert (canon_expr_type != NULL_TREE); + if (canon_expr_type == NULL_TREE) + { + error_at (loc, + "first argument to %<va_arg%> not of type %<va_list%>"); + return error_mark_node; + } } else { |