diff options
author | Marek Polacek <mpolacek@gcc.gnu.org> | 2015-04-28 08:36:50 +0000 |
---|---|---|
committer | Marek Polacek <mpolacek@gcc.gnu.org> | 2015-04-28 08:36:50 +0000 |
commit | 4e81b788bb6a2f4ecc51965232727d86ca375c94 (patch) | |
tree | e4a78f92a29b33f3fb61d3b79130e6b5b072cc49 /gcc/c | |
parent | 90dd6e3df86c81bdc1380513c57cce64caf32f72 (diff) | |
download | gcc-4e81b788bb6a2f4ecc51965232727d86ca375c94.zip gcc-4e81b788bb6a2f4ecc51965232727d86ca375c94.tar.gz gcc-4e81b788bb6a2f4ecc51965232727d86ca375c94.tar.bz2 |
re PR c/65901 (no warning or error for va_arg (ap, void))
PR c/65901
* c-typeck.c (c_build_va_arg): Require TYPE be a complete type.
* gcc.c-torture/compile/pr48767.c (foo): Add dg-error.
* gcc.dg/pr65901.c: New test.
From-SVN: r222515
Diffstat (limited to 'gcc/c')
-rw-r--r-- | gcc/c/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/c/c-typeck.c | 5 |
2 files changed, 10 insertions, 0 deletions
diff --git a/gcc/c/ChangeLog b/gcc/c/ChangeLog index 938262a9..5d50d4c 100644 --- a/gcc/c/ChangeLog +++ b/gcc/c/ChangeLog @@ -1,3 +1,8 @@ +2015-04-28 Marek Polacek <polacek@redhat.com> + + PR c/65901 + * c-typeck.c (c_build_va_arg): Require TYPE be a complete type. + 2015-04-25 Marek Polacek <polacek@redhat.com> PR c/52085 diff --git a/gcc/c/c-typeck.c b/gcc/c/c-typeck.c index 91735b5..c58e918 100644 --- a/gcc/c/c-typeck.c +++ b/gcc/c/c-typeck.c @@ -12648,6 +12648,11 @@ c_build_va_arg (location_t loc, tree expr, tree type) if (warn_cxx_compat && TREE_CODE (type) == ENUMERAL_TYPE) warning_at (loc, OPT_Wc___compat, "C++ requires promoted type, not enum type, in %<va_arg%>"); + if (type == error_mark_node || !COMPLETE_TYPE_P (type)) + { + c_incomplete_type_error (NULL_TREE, type); + return error_mark_node; + } return build_va_arg (loc, expr, type); } |