diff options
author | Jakub Jelinek <jakub@redhat.com> | 2011-05-23 20:02:03 +0200 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2011-05-23 20:02:03 +0200 |
commit | 0e0d82a784effdcfab26696cab66d03ed5f22300 (patch) | |
tree | bb4e4965a02884e4f452f6882c7b2464c3220258 /gcc | |
parent | 65712d5cf1e778ae8518b2193e484c53ddf1eb53 (diff) | |
download | gcc-0e0d82a784effdcfab26696cab66d03ed5f22300.zip gcc-0e0d82a784effdcfab26696cab66d03ed5f22300.tar.gz gcc-0e0d82a784effdcfab26696cab66d03ed5f22300.tar.bz2 |
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
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/c-decl.c | 2 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/pr49120.c | 11 |
4 files changed, 22 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 9771921..4c73adb 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +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 diff --git a/gcc/c-decl.c b/gcc/c-decl.c index 3843f77..a7cc965 100644 --- a/gcc/c-decl.c +++ b/gcc/c-decl.c @@ -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); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 85137d0..65a3514 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +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 diff --git a/gcc/testsuite/gcc.dg/pr49120.c b/gcc/testsuite/gcc.dg/pr49120.c new file mode 100644 index 0000000..1a65222 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr49120.c @@ -0,0 +1,11 @@ +/* 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; +} |