re PR middle-end/30729 (value computed is not used warning with unused result of va_arg)

2007-02-15  Andrew Pinski  <andrew_pinski@playstation.sony.com>

        PR middle-end/30729
        * stmt.c (warn_if_unused_value): VA_ARG_EXPR has side
        effects unknown to this function, return early.

2007-02-15  Andrew Pinski  <andrew_pinski@playstation.sony.com>

        PR middle-end/30729
        * gcc.dg/Wunused-value-2.c: New testcase.

From-SVN: r122027
This commit is contained in:
Andrew Pinski 2007-02-16 01:19:23 +00:00 committed by Andrew Pinski
parent d0fc3f0654
commit d3d6f724f2
4 changed files with 30 additions and 0 deletions

View File

@ -1,3 +1,9 @@
2007-02-15 Andrew Pinski <andrew_pinski@playstation.sony.com>
PR middle-end/30729
* stmt.c (warn_if_unused_value): VA_ARG_EXPR has side
effects unknown to this function, return early.
2007-02-15 Ian Lance Taylor <iant@google.com>
* lower-subreg.c (move_eh_region_note): New static function.

View File

@ -1425,6 +1425,7 @@ warn_if_unused_value (tree exp, location_t locus)
case TRY_CATCH_EXPR:
case WITH_CLEANUP_EXPR:
case EXIT_EXPR:
case VA_ARG_EXPR:
return 0;
case BIND_EXPR:

View File

@ -1,3 +1,8 @@
2007-02-15 Andrew Pinski <andrew_pinski@playstation.sony.com>
PR middle-end/30729
* gcc.dg/Wunused-value-2.c: New testcase.
2007-02-15 Ian Lance Taylor <iant@google.com>
* g++.dg/eh/subreg-1.C: New test.

View File

@ -0,0 +1,18 @@
/* Test -Wunused-value. Bug 30729. */
/* { dg-do compile } */
/* { dg-options "-Wunused-value" } */
/* Make sure va_arg does not cause a value computed is not used warning
because it has side effects. */
#include <stdarg.h>
int f(int t, ...)
{
va_list a;
va_start (a, t);
va_arg(a, int);/* { dg-bogus "value computed is not used" } */
int t1 = va_arg(a, int);
va_end(a);
return t1;
}