Commit 0e0d82a7 by Jakub Jelinek Committed by Jakub Jelinek

re PR c/49120 (bogus "value computed is not used" warning (variable-length array…

re PR c/49120 (bogus "value computed is not used" warning (variable-length array in compound statement))

	PR c/49120
	* c-decl.c (start_decl): Convert expr to void_type_node.

	* gcc.dg/pr49120.c: New test.

From-SVN: r174081
parent 65712d5c
2011-05-23 Jakub Jelinek <jakub@redhat.com>
PR c/49120
* c-decl.c (start_decl): Convert expr to void_type_node.
2011-05-23 Richard Sandiford <rdsandiford@googlemail.com>
PR rtl-optimization/48826
......
......@@ -3942,7 +3942,7 @@ start_decl (struct c_declarator *declarator, struct c_declspecs *declspecs,
return 0;
if (expr)
add_stmt (expr);
add_stmt (fold_convert (void_type_node, expr));
if (TREE_CODE (decl) != FUNCTION_DECL && MAIN_NAME_P (DECL_NAME (decl)))
warning (OPT_Wmain, "%q+D is usually a function", decl);
......
2011-05-23 Jakub Jelinek <jakub@redhat.com>
PR c/49120
* gcc.dg/pr49120.c: New test.
2011-05-23 H.J. Lu <hongjiu.lu@intel.com>
PR target/47315
......
/* PR c/49120 */
/* { dg-do compile } */
/* { dg-options "-Wall" } */
int
main ()
{
int a = 1;
int c = ({ char b[a + 1]; b[0] = 0; b[0]; });
return c;
}
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