re PR c/46015 (-Wunused-but-set-variable warns for arrays used in gotos)
PR c/46015 * c-parser.c (c_parser_statement_after_labels): Call mark_exp_read on computed goto argument. * semantics.c (finish_goto_stmt): Call mark_rvalue_use on computed goto destination. * c-c++-common/Wunused-var-13.c: New test. From-SVN: r165643
This commit is contained in:
parent
0f8d623157
commit
84628aa836
6 changed files with 50 additions and 2 deletions
|
@ -1,3 +1,9 @@
|
|||
2010-10-18 Jakub Jelinek <jakub@redhat.com>
|
||||
|
||||
PR c/46015
|
||||
* c-parser.c (c_parser_statement_after_labels): Call mark_exp_read
|
||||
on computed goto argument.
|
||||
|
||||
2010-10-18 Richard Guenther <rguenther@suse.de>
|
||||
|
||||
PR tree-optimization/45967
|
||||
|
|
|
@ -4151,9 +4151,12 @@ c_parser_statement_after_labels (c_parser *parser)
|
|||
}
|
||||
else if (c_parser_next_token_is (parser, CPP_MULT))
|
||||
{
|
||||
tree val;
|
||||
|
||||
c_parser_consume_token (parser);
|
||||
stmt = c_finish_goto_ptr (loc,
|
||||
c_parser_expression (parser).value);
|
||||
val = c_parser_expression (parser).value;
|
||||
mark_exp_read (val);
|
||||
stmt = c_finish_goto_ptr (loc, val);
|
||||
}
|
||||
else
|
||||
c_parser_error (parser, "expected identifier or %<*%>");
|
||||
|
|
|
@ -1,3 +1,9 @@
|
|||
2010-10-18 Jakub Jelinek <jakub@redhat.com>
|
||||
|
||||
PR c/46015
|
||||
* semantics.c (finish_goto_stmt): Call mark_rvalue_use on computed
|
||||
goto destination.
|
||||
|
||||
2010-10-17 Nicola Pero <nicola.pero@meta-innovation.com>
|
||||
|
||||
Merge from apple/trunk branch on FSF servers.
|
||||
|
|
|
@ -537,6 +537,7 @@ finish_goto_stmt (tree destination)
|
|||
TREE_USED (destination) = 1;
|
||||
else
|
||||
{
|
||||
destination = mark_rvalue_use (destination);
|
||||
if (!processing_template_decl)
|
||||
{
|
||||
destination = cp_convert (ptr_type_node, destination);
|
||||
|
|
|
@ -1,3 +1,8 @@
|
|||
2010-10-18 Jakub Jelinek <jakub@redhat.com>
|
||||
|
||||
PR c/46015
|
||||
* c-c++-common/Wunused-var-13.c: New test.
|
||||
|
||||
2010-10-18 Richard Guenther <rguenther@suse.de>
|
||||
|
||||
PR tree-optimization/45967
|
||||
|
|
27
gcc/testsuite/c-c++-common/Wunused-var-13.c
Normal file
27
gcc/testsuite/c-c++-common/Wunused-var-13.c
Normal file
|
@ -0,0 +1,27 @@
|
|||
/* PR c/46015 */
|
||||
/* { dg-options "-Wunused" } */
|
||||
/* { dg-do compile } */
|
||||
|
||||
int
|
||||
f1 (int i)
|
||||
{
|
||||
static void *labs[2] = { &&lab1, &&lab2 };
|
||||
goto *(labs[i & 1]);
|
||||
|
||||
lab1:
|
||||
return 1;
|
||||
lab2:
|
||||
return 2;
|
||||
}
|
||||
|
||||
int
|
||||
f2 (int i)
|
||||
{
|
||||
void *labs[2] = { &&lab1, &&lab2 };
|
||||
goto *labs[i & 1];
|
||||
|
||||
lab1:
|
||||
return 1;
|
||||
lab2:
|
||||
return 2;
|
||||
}
|
Loading…
Add table
Reference in a new issue