Commit 4e81b788 by Marek Polacek

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
parent 90dd6e3d
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
......
......@@ -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);
}
......
2015-04-28 Marek Polacek <polacek@redhat.com>
PR c/65901
* gcc.c-torture/compile/pr48767.c (foo): Add dg-error.
* gcc.dg/pr65901.c: New test.
2015-04-28 Richard Biener <rguenther@suse.de>
PR tree-optimization/62283
......@@ -11,7 +17,7 @@
2015-04-27 Jeff Law <law@redhat.com>
PR tree-optimization/65217
PR tree-optimization/65217
* gcc.target/i386/pr65217.c: Remove XFAIL.
2015-04-27 Andre Vehreschild <vehre@gmx.de>
......
......@@ -3,5 +3,5 @@
void
foo (__builtin_va_list ap)
{
__builtin_va_arg (ap, void);
__builtin_va_arg (ap, void); /* { dg-error "invalid use of void expression" } */
}
/* PR c/65901 */
/* { dg-do compile } */
/* { dg-options "" } */
struct S;
enum E;
union U;
void
foo (__builtin_va_list ap)
{
__builtin_va_arg (ap, void); /* { dg-error "invalid use of void expression" } */
__builtin_va_arg (ap, struct S); /* { dg-error "invalid use of undefined type" } */
__builtin_va_arg (ap, enum E); /* { dg-error "invalid use of undefined type" } */
__builtin_va_arg (ap, union U); /* { dg-error "invalid use of undefined type" } */
}
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