public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug middle-end/34212]  New: spurious warning: value computed is not used
@ 2007-11-24  2:16 pluto at agmk dot net
  2007-11-24  2:30 ` [Bug middle-end/34212] " pluto at agmk dot net
                   ` (12 more replies)
  0 siblings, 13 replies; 14+ messages in thread
From: pluto at agmk dot net @ 2007-11-24  2:16 UTC (permalink / raw)
  To: gcc-bugs

long f( long& );
template < typename T, bool B >
struct X
{
        X() : r_()
        {
                B ? f( r_ ) : ++r_;
        }
        long r_;
};
X< int, false > h;


$ /opt/gcc43/bin/g++ t.cpp -Wall -c
t.cpp: In constructor 'X<T, B>::X() [with T = int, bool B = false]':
t.cpp:11:   instantiated from here
t.cpp:7: warning: value computed is not used

this bug may be related to PR26632.


-- 
           Summary: spurious warning: value computed is not used
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: middle-end
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: pluto at agmk dot net


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34212


^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Bug middle-end/34212] spurious warning: value computed is not used
  2007-11-24  2:16 [Bug middle-end/34212] New: spurious warning: value computed is not used pluto at agmk dot net
@ 2007-11-24  2:30 ` pluto at agmk dot net
  2007-11-24 12:15 ` pinskia at gcc dot gnu dot org
                   ` (11 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: pluto at agmk dot net @ 2007-11-24  2:30 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from pluto at agmk dot net  2007-11-24 02:30 -------
the warning isn't emitted when i change ++r_ into r_++.
t.cpp.003t.original changes:

-  (void) NON_LVALUE_EXPR < ++((struct X<int,false> *) this)->r_> >>>
+  (void) ((struct X<int,false> *) this)->r_++  >>>


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34212


^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Bug middle-end/34212] spurious warning: value computed is not used
  2007-11-24  2:16 [Bug middle-end/34212] New: spurious warning: value computed is not used pluto at agmk dot net
  2007-11-24  2:30 ` [Bug middle-end/34212] " pluto at agmk dot net
@ 2007-11-24 12:15 ` pinskia at gcc dot gnu dot org
  2007-11-24 18:50 ` pluto at agmk dot net
                   ` (10 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2007-11-24 12:15 UTC (permalink / raw)
  To: gcc-bugs



------- 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


^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Bug middle-end/34212] spurious warning: value computed is not used
  2007-11-24  2:16 [Bug middle-end/34212] New: spurious warning: value computed is not used pluto at agmk dot net
  2007-11-24  2:30 ` [Bug middle-end/34212] " pluto at agmk dot net
  2007-11-24 12:15 ` pinskia at gcc dot gnu dot org
@ 2007-11-24 18:50 ` pluto at agmk dot net
  2007-11-25  3:10 ` pinskia at gcc dot gnu dot org
                   ` (9 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: pluto at agmk dot net @ 2007-11-24 18:50 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from pluto at agmk dot net  2007-11-24 18:50 -------
(In reply to comment #2)
> A quick untested patch which I have not even tested on this testcase:

doesn't work.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34212


^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Bug middle-end/34212] spurious warning: value computed is not used
  2007-11-24  2:16 [Bug middle-end/34212] New: spurious warning: value computed is not used pluto at agmk dot net
                   ` (2 preceding siblings ...)
  2007-11-24 18:50 ` pluto at agmk dot net
@ 2007-11-25  3:10 ` pinskia at gcc dot gnu dot org
  2007-12-03  3:18 ` pinskia at gcc dot gnu dot org
                   ` (8 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2007-11-25  3:10 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from pinskia at gcc dot gnu dot org  2007-11-25 03:10 -------
Confirmed, and here is a patch which really fixes the issue:
Index: ../../gcc/cp/cvt.c
===================================================================
--- ../../gcc/cp/cvt.c  (revision 130402)
+++ ../../gcc/cp/cvt.c  (working copy)
@@ -941,7 +941,8 @@ convert_to_void (tree expr, const char *
                 conversions.  Do not use STRIP_NOPs because it will
                 not strip conversions to "void", as that is not a
                 mode-preserving conversion.  */
-             while (TREE_CODE (e) == NOP_EXPR)
+             while (TREE_CODE (e) == NOP_EXPR
+                    || TREE_CODE (e) == NON_LVALUE_EXPR)
                e = TREE_OPERAND (e, 0);

              code = TREE_CODE (e);


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
           Keywords|                            |diagnostic
      Known to fail|                            |4.0.0 4.0.4 4.1.2 4.2.0
                   |                            |4.3.0
   Last reconfirmed|0000-00-00 00:00:00         |2007-11-25 03:10:52
               date|                            |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34212


^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Bug middle-end/34212] spurious warning: value computed is not used
  2007-11-24  2:16 [Bug middle-end/34212] New: spurious warning: value computed is not used pluto at agmk dot net
                   ` (3 preceding siblings ...)
  2007-11-25  3:10 ` pinskia at gcc dot gnu dot org
@ 2007-12-03  3:18 ` pinskia at gcc dot gnu dot org
  2008-01-08 19:24 ` pluto at agmk dot net
                   ` (7 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2007-12-03  3:18 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from pinskia at gcc dot gnu dot org  2007-12-03 03:17 -------
Mine, but this will not get in until around the 25th.


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |pinskia at gcc dot gnu dot
                   |dot org                     |org
             Status|NEW                         |ASSIGNED


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34212


^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Bug middle-end/34212] spurious warning: value computed is not used
  2007-11-24  2:16 [Bug middle-end/34212] New: spurious warning: value computed is not used pluto at agmk dot net
                   ` (4 preceding siblings ...)
  2007-12-03  3:18 ` pinskia at gcc dot gnu dot org
@ 2008-01-08 19:24 ` pluto at agmk dot net
  2008-02-23 20:33 ` pluto at agmk dot net
                   ` (6 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: pluto at agmk dot net @ 2008-01-08 19:24 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from pluto at agmk dot net  2008-01-08 19:00 -------
(In reply to comment #5)
> Mine, but this will not get in until around the 25th.
> 

ping ;)


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34212


^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Bug middle-end/34212] spurious warning: value computed is not used
  2007-11-24  2:16 [Bug middle-end/34212] New: spurious warning: value computed is not used pluto at agmk dot net
                   ` (5 preceding siblings ...)
  2008-01-08 19:24 ` pluto at agmk dot net
@ 2008-02-23 20:33 ` pluto at agmk dot net
  2008-02-23 20:35 ` pinskia at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: pluto at agmk dot net @ 2008-02-23 20:33 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from pluto at agmk dot net  2008-02-23 20:33 -------
ping^2


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34212


^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Bug middle-end/34212] spurious warning: value computed is not used
  2007-11-24  2:16 [Bug middle-end/34212] New: spurious warning: value computed is not used pluto at agmk dot net
                   ` (6 preceding siblings ...)
  2008-02-23 20:33 ` pluto at agmk dot net
@ 2008-02-23 20:35 ` pinskia at gcc dot gnu dot org
  2008-03-12  3:49 ` pinskia at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2008-02-23 20:35 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #8 from pinskia at gcc dot gnu dot org  2008-02-23 20:35 -------
(In reply to comment #7)
> ping^2

I am just finally getting back to my assigned bugs after so long, this is lower
down on the list than some other ones.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34212


^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Bug middle-end/34212] spurious warning: value computed is not used
  2007-11-24  2:16 [Bug middle-end/34212] New: spurious warning: value computed is not used pluto at agmk dot net
                   ` (7 preceding siblings ...)
  2008-02-23 20:35 ` pinskia at gcc dot gnu dot org
@ 2008-03-12  3:49 ` pinskia at gcc dot gnu dot org
  2008-03-13  5:28 ` pinskia at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2008-03-12  3:49 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #9 from pinskia at gcc dot gnu dot org  2008-03-12 03:48 -------
I should be able to submit this patch tomorrow morning after the testing
finishes.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34212


^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Bug middle-end/34212] spurious warning: value computed is not used
  2007-11-24  2:16 [Bug middle-end/34212] New: spurious warning: value computed is not used pluto at agmk dot net
                   ` (8 preceding siblings ...)
  2008-03-12  3:49 ` pinskia at gcc dot gnu dot org
@ 2008-03-13  5:28 ` pinskia at gcc dot gnu dot org
  2008-03-13  5:31 ` pinskia at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2008-03-13  5:28 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #10 from pinskia at gcc dot gnu dot org  2008-03-13 05:27 -------
+FAIL: g++.dg/warn/Wunused-9.C  (test for warnings, line 32)

  +f(); // { dg-warning "not used" }

+FAIL: g++.dg/warn/noeffect4.C  (test for warnings, line 80)

  const_cast<X &> (x.Foo ());       // { dg-warning "not used" }

I think the second one should not be warned about, but the first one I don't
know about.  I am going to unassign this from me because of these regressions.


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|pinskia at gcc dot gnu dot  |unassigned at gcc dot gnu
                   |org                         |dot org
             Status|ASSIGNED                    |NEW


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34212


^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Bug middle-end/34212] spurious warning: value computed is not used
  2007-11-24  2:16 [Bug middle-end/34212] New: spurious warning: value computed is not used pluto at agmk dot net
                   ` (9 preceding siblings ...)
  2008-03-13  5:28 ` pinskia at gcc dot gnu dot org
@ 2008-03-13  5:31 ` pinskia at gcc dot gnu dot org
  2008-03-24  9:10 ` pinskia at gcc dot gnu dot org
  2010-05-05 19:35 ` pluto at agmk dot net
  12 siblings, 0 replies; 14+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2008-03-13  5:31 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #11 from pinskia at gcc dot gnu dot org  2008-03-13 05:30 -------
Actually I was looking at the wrong testresults :).  The build failed but I
think that was my machine acting up again.


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |pinskia at gcc dot gnu dot
                   |dot org                     |org
             Status|NEW                         |ASSIGNED
   Last reconfirmed|2007-11-25 03:10:52         |2008-03-13 05:30:28
               date|                            |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34212


^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Bug middle-end/34212] spurious warning: value computed is not used
  2007-11-24  2:16 [Bug middle-end/34212] New: spurious warning: value computed is not used pluto at agmk dot net
                   ` (10 preceding siblings ...)
  2008-03-13  5:31 ` pinskia at gcc dot gnu dot org
@ 2008-03-24  9:10 ` pinskia at gcc dot gnu dot org
  2010-05-05 19:35 ` pluto at agmk dot net
  12 siblings, 0 replies; 14+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2008-03-24  9:10 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #12 from pinskia at gcc dot gnu dot org  2008-03-24 09:09 -------
My patch does not work as we now don't warn for +f(); which is wrong.  I am no
longer going to work on this.


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|pinskia at gcc dot gnu dot  |unassigned at gcc dot gnu
                   |org                         |dot org
             Status|ASSIGNED                    |NEW


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34212


^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Bug middle-end/34212] spurious warning: value computed is not used
  2007-11-24  2:16 [Bug middle-end/34212] New: spurious warning: value computed is not used pluto at agmk dot net
                   ` (11 preceding siblings ...)
  2008-03-24  9:10 ` pinskia at gcc dot gnu dot org
@ 2010-05-05 19:35 ` pluto at agmk dot net
  12 siblings, 0 replies; 14+ messages in thread
From: pluto at agmk dot net @ 2010-05-05 19:35 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #13 from pluto at agmk dot net  2010-05-05 19:35 -------
queue.push_back with low prio ;)


-- 

pluto at agmk dot net changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |manu at gcc dot gnu dot org
      Known to fail|4.0.0 4.0.4 4.1.2 4.2.0     |4.0.0 4.0.4 4.1.2 4.2.0
                   |4.3.0 4.4.0 4.5.0           |4.3.0 4.4.0 4.5.0 4.6.0


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34212


^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2010-05-05 19:35 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-11-24  2:16 [Bug middle-end/34212] New: spurious warning: value computed is not used pluto at agmk dot net
2007-11-24  2:30 ` [Bug middle-end/34212] " pluto at agmk dot net
2007-11-24 12:15 ` pinskia at gcc dot gnu dot org
2007-11-24 18:50 ` pluto at agmk dot net
2007-11-25  3:10 ` pinskia at gcc dot gnu dot org
2007-12-03  3:18 ` pinskia at gcc dot gnu dot org
2008-01-08 19:24 ` pluto at agmk dot net
2008-02-23 20:33 ` pluto at agmk dot net
2008-02-23 20:35 ` pinskia at gcc dot gnu dot org
2008-03-12  3:49 ` pinskia at gcc dot gnu dot org
2008-03-13  5:28 ` pinskia at gcc dot gnu dot org
2008-03-13  5:31 ` pinskia at gcc dot gnu dot org
2008-03-24  9:10 ` pinskia at gcc dot gnu dot org
2010-05-05 19:35 ` pluto at agmk dot net

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).