This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug middle-end/34212] spurious warning: value computed is not used
- From: "pinskia at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 24 Nov 2007 12:15:52 -0000
- Subject: [Bug middle-end/34212] spurious warning: value computed is not used
- References: <bug-34212-7667@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #2 from pinskia at gcc dot gnu dot org 2007-11-24 12:15 -------
A quick untested patch which I have not even tested on this testcase:
Index: stmt.c
===================================================================
--- stmt.c (revision 130381)
+++ stmt.c (working copy)
@@ -1408,6 +1408,9 @@ warn_if_unused_value (const_tree exp, lo
if (EXPR_HAS_LOCATION (exp))
locus = EXPR_LOCATION (exp);
+ while (TREE_CODE (exp) == NON_LVALUE_EXPR)
+ exp = TREE_OPERAND (exp, 0);
+
switch (TREE_CODE (exp))
{
case PREINCREMENT_EXPR:
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34212