Commit 1e77281b by Marek Polacek Committed by Marek Polacek

re PR c/70651 (ICE on invalid code on x86_64-linux-gnu in build_va_arg, at…

re PR c/70651 (ICE on invalid code on x86_64-linux-gnu in build_va_arg, at c-family/c-common.c:5728)

	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.

From-SVN: r235027
parent 51dbe4a0
2016-04-15 Marek Polacek <polacek@redhat.com>
PR c/70651
* c-common.c (build_va_arg): Change two asserts into errors and return
error_mark_node.
2016-04-13 Marek Polacek <polacek@redhat.com> 2016-04-13 Marek Polacek <polacek@redhat.com>
PR c++/70639 PR c++/70639
......
...@@ -5725,7 +5725,12 @@ build_va_arg (location_t loc, tree expr, tree type) ...@@ -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. */ /* Verify that &ap is still recognized as having va_list type. */
tree canon_expr_type tree canon_expr_type
= targetm.canonical_va_list_type (TREE_TYPE (expr)); = 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); return build_va_arg_1 (loc, type, expr);
} }
...@@ -5793,7 +5798,12 @@ build_va_arg (location_t loc, tree expr, tree type) ...@@ -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. */ /* Verify that &ap is still recognized as having va_list type. */
tree canon_expr_type tree canon_expr_type
= targetm.canonical_va_list_type (TREE_TYPE (expr)); = 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 else
{ {
......
2016-04-15 Marek Polacek <polacek@redhat.com>
PR c/70651
* c-c++-common/pr70651.c: New test.
2016-04-15 Kyrylo Tkachov <kyrylo.tkachov@arm.com> 2016-04-15 Kyrylo Tkachov <kyrylo.tkachov@arm.com>
PR rtl-optimization/70681 PR rtl-optimization/70681
......
/* PR c/70651 */
/* { dg-do compile } */
/* { dg-prune-output "\[^\n\r\]*first argument to .va_arg. not of type .va_list.\[^\n\r\]*" } */
void fn1 ()
{
char **a = 0;
__builtin_va_arg (a, char **);
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment