public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/26632]  New: spurious warning: value computed is not used
@ 2006-03-10 15:15 mattias at virtutech dot se
  2006-03-10 15:17 ` [Bug middle-end/26632] [4.1/4.2 Regression] " pinskia at gcc dot gnu dot org
                   ` (12 more replies)
  0 siblings, 13 replies; 14+ messages in thread
From: mattias at virtutech dot se @ 2006-03-10 15:15 UTC (permalink / raw)
  To: gcc-bugs

Using gcc 4.1.0 on amd64, with -Wall (64 bit target):

int g(void);
long h(void);
void f(void)
{
        0 ? h() : g();
}

foo.c:6: warning: value computed is not used

Either changing 0 to 1 or swapping g and h makes the warning go away.
This was the result of a (very reasonable) macro expansion.


-- 
           Summary: spurious warning: value computed is not used
           Product: gcc
           Version: 4.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: mattias at virtutech dot se
 GCC build triplet: x86_64-unknown-linux-gnu
  GCC host triplet: x86_64-unknown-linux-gnu
GCC target triplet: x86_64-unknown-linux-gnu


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


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

* [Bug middle-end/26632] [4.1/4.2 Regression] spurious warning: value computed is not used
  2006-03-10 15:15 [Bug c/26632] New: spurious warning: value computed is not used mattias at virtutech dot se
@ 2006-03-10 15:17 ` pinskia at gcc dot gnu dot org
  2006-03-10 15:17 ` [Bug middle-end/26632] " pinskia at gcc dot gnu dot org
                   ` (11 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-03-10 15:17 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from pinskia at gcc dot gnu dot org  2006-03-10 15:17 -------
I don't know if we should be warning or not.


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |pinskia at gcc dot gnu dot
                   |                            |org
           Keywords|                            |diagnostic
            Summary|spurious warning: value     |[4.1/4.2 Regression]
                   |computed is not used        |spurious warning: value
                   |                            |computed is not used
   Target Milestone|---                         |4.1.1


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


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

* [Bug middle-end/26632] spurious warning: value computed is not used
  2006-03-10 15:15 [Bug c/26632] New: spurious warning: value computed is not used mattias at virtutech dot se
  2006-03-10 15:17 ` [Bug middle-end/26632] [4.1/4.2 Regression] " pinskia at gcc dot gnu dot org
@ 2006-03-10 15:17 ` pinskia at gcc dot gnu dot org
  2006-03-10 15:30 ` [Bug middle-end/26632] [4.1/4.2 Regression] " mattias at virtutech dot se
                   ` (10 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-03-10 15:17 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from pinskia at gcc dot gnu dot org  2006-03-10 15:16 -------
Hmm, what is going on here is the following.
        0 ? h() : g();
is not really just that but instead:
        0 ? h() : (long)g();
which then gets foldded into:
(long)g();
and we warn about the cast.


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|c                           |middle-end


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


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

* [Bug middle-end/26632] [4.1/4.2 Regression] spurious warning: value computed is not used
  2006-03-10 15:15 [Bug c/26632] New: spurious warning: value computed is not used mattias at virtutech dot se
  2006-03-10 15:17 ` [Bug middle-end/26632] [4.1/4.2 Regression] " pinskia at gcc dot gnu dot org
  2006-03-10 15:17 ` [Bug middle-end/26632] " pinskia at gcc dot gnu dot org
@ 2006-03-10 15:30 ` mattias at virtutech dot se
  2006-03-11  0:16 ` neil at daikokuya dot co dot uk
                   ` (9 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: mattias at virtutech dot se @ 2006-03-10 15:30 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from mattias at virtutech dot se  2006-03-10 15:30 -------
Yes, I realise it's the implicit integral conversion that causes the warning,
but since the result is not used no matter what it seems wrong to warn for it -
it cannot reasonably a sign of an error in the code.

It can be hard to avoid unless the exact types and sizes are known - for
instance, adding (long) casts to both branches will not prevent the warning
from being generated. This causes headaches with -Werror.

In fact, adding an (int) cast before h() will suppress the warning but a (long)
cast before g() will not. I see no sensible way of getting rid of the warning
at all, save casting the whole result to void (which isn't desirable for a
function-like macro).


-- 


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


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

* [Bug middle-end/26632] [4.1/4.2 Regression] spurious warning: value computed is not used
  2006-03-10 15:15 [Bug c/26632] New: spurious warning: value computed is not used mattias at virtutech dot se
                   ` (2 preceding siblings ...)
  2006-03-10 15:30 ` [Bug middle-end/26632] [4.1/4.2 Regression] " mattias at virtutech dot se
@ 2006-03-11  0:16 ` neil at daikokuya dot co dot uk
  2006-04-16 18:58 ` mmitchel at gcc dot gnu dot org
                   ` (8 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: neil at daikokuya dot co dot uk @ 2006-03-11  0:16 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from neil at daikokuya dot co dot uk  2006-03-11 00:15 -------
Subject: Re:  spurious warning: value computed is not used

pinskia at gcc dot gnu dot org wrote:-

> 
> 
> ------- Comment #1 from pinskia at gcc dot gnu dot org  2006-03-10 15:16 -------
> Hmm, what is going on here is the following.
>         0 ? h() : g();
> is not really just that but instead:
>         0 ? h() : (long)g();
> which then gets foldded into:
> (long)g();
> and we warn about the cast.

Every time we get bitten by issuing diagnostics after parts of GCC
other than the front end manipulate the IR.  These bugs won't go
away until GCC stops doing this.

Neil.


-- 


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


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

* [Bug middle-end/26632] [4.1/4.2 Regression] spurious warning: value computed is not used
  2006-03-10 15:15 [Bug c/26632] New: spurious warning: value computed is not used mattias at virtutech dot se
                   ` (3 preceding siblings ...)
  2006-03-11  0:16 ` neil at daikokuya dot co dot uk
@ 2006-04-16 18:58 ` mmitchel at gcc dot gnu dot org
  2006-05-25  2:46 ` mmitchel at gcc dot gnu dot org
                   ` (7 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2006-04-16 18:58 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from mmitchel at gcc dot gnu dot org  2006-04-16 18:58 -------
I am glad that Neil agrees my oft-stated, but always-rejected, claim that only
the front ends should issue warnings.  :-)

However, in this case, we can presumably fix the bug by setting TREE_NO_WARNING
on the cast expression, which, one hopes, is generated by the front end.

In any case, this is definitely a bug. 


-- 

mmitchel at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P2


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


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

* [Bug middle-end/26632] [4.1/4.2 Regression] spurious warning: value computed is not used
  2006-03-10 15:15 [Bug c/26632] New: spurious warning: value computed is not used mattias at virtutech dot se
                   ` (4 preceding siblings ...)
  2006-04-16 18:58 ` mmitchel at gcc dot gnu dot org
@ 2006-05-25  2:46 ` mmitchel at gcc dot gnu dot org
  2006-05-30 13:54 ` pinskia at gcc dot gnu dot org
                   ` (6 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2006-05-25  2:46 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from mmitchel at gcc dot gnu dot org  2006-05-25 02:34 -------
Will not be fixed in 4.1.1; adjust target milestone to 4.1.2.


-- 

mmitchel at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|4.1.1                       |4.1.2


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


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

* [Bug middle-end/26632] [4.1/4.2 Regression] spurious warning: value computed is not used
  2006-03-10 15:15 [Bug c/26632] New: spurious warning: value computed is not used mattias at virtutech dot se
                   ` (5 preceding siblings ...)
  2006-05-25  2:46 ` mmitchel at gcc dot gnu dot org
@ 2006-05-30 13:54 ` pinskia at gcc dot gnu dot org
  2006-06-30  6:08 ` pinskia at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-05-30 13:54 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from pinskia at gcc dot gnu dot org  2006-05-30 13:54 -------
*** Bug 27825 has been marked as a duplicate of this bug. ***


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ebermann at decomsys dot com


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


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

* [Bug middle-end/26632] [4.1/4.2 Regression] spurious warning: value computed is not used
  2006-03-10 15:15 [Bug c/26632] New: spurious warning: value computed is not used mattias at virtutech dot se
                   ` (6 preceding siblings ...)
  2006-05-30 13:54 ` pinskia at gcc dot gnu dot org
@ 2006-06-30  6:08 ` pinskia at gcc dot gnu dot org
  2006-08-28  6: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 @ 2006-06-30  6:08 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #8 from pinskia at gcc dot gnu dot org  2006-06-30 06:07 -------
Confirmed.


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2006-06-30 06:07:10
               date|                            |


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


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

* [Bug middle-end/26632] [4.1/4.2 Regression] spurious warning: value computed is not used
  2006-03-10 15:15 [Bug c/26632] New: spurious warning: value computed is not used mattias at virtutech dot se
                   ` (7 preceding siblings ...)
  2006-06-30  6:08 ` pinskia at gcc dot gnu dot org
@ 2006-08-28  6:49 ` pinskia at gcc dot gnu dot org
  2006-08-28 17:18 ` kazu 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 @ 2006-08-28  6:49 UTC (permalink / raw)
  To: gcc-bugs



-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |kazu at gcc dot gnu dot org
                   |dot org                     |
                URL|                            |http://gcc.gnu.org/ml/gcc-
                   |                            |patches/2006-
                   |                            |08/msg01041.html
             Status|NEW                         |ASSIGNED
  GCC build triplet|x86_64-unknown-linux-gnu    |
   GCC host triplet|x86_64-unknown-linux-gnu    |
 GCC target triplet|x86_64-unknown-linux-gnu    |
           Keywords|                            |patch


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


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

* [Bug middle-end/26632] [4.1/4.2 Regression] spurious warning: value computed is not used
  2006-03-10 15:15 [Bug c/26632] New: spurious warning: value computed is not used mattias at virtutech dot se
                   ` (8 preceding siblings ...)
  2006-08-28  6:49 ` pinskia at gcc dot gnu dot org
@ 2006-08-28 17:18 ` kazu at gcc dot gnu dot org
  2006-08-30  6:00 ` [Bug middle-end/26632] [4.1 " kazu at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: kazu at gcc dot gnu dot org @ 2006-08-28 17:18 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #9 from kazu at gcc dot gnu dot org  2006-08-28 17:18 -------
Subject: Bug 26632

Author: kazu
Date: Mon Aug 28 17:18:29 2006
New Revision: 116510

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=116510
Log:
gcc/
        PR middle-end/26632
        * convert.c (convert_to_integer): Set TREE_NO_WARNING to 1 on
        an implicit conversion.

gcc/testsuite/
        PR middle-end/26632
        * gcc.dg/pr26632.c: New.

Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/convert.c
    trunk/gcc/testsuite/ChangeLog


-- 


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


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

* [Bug middle-end/26632] [4.1 Regression] spurious warning: value computed is not used
  2006-03-10 15:15 [Bug c/26632] New: spurious warning: value computed is not used mattias at virtutech dot se
                   ` (9 preceding siblings ...)
  2006-08-28 17:18 ` kazu at gcc dot gnu dot org
@ 2006-08-30  6:00 ` kazu at gcc dot gnu dot org
  2007-02-14  9:10 ` mmitchel at gcc dot gnu dot org
  2008-07-04 15:23 ` jsm28 at gcc dot gnu dot org
  12 siblings, 0 replies; 14+ messages in thread
From: kazu at gcc dot gnu dot org @ 2006-08-30  6:00 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #10 from kazu at gcc dot gnu dot org  2006-08-30 06:00 -------
Subject: Bug 26632

Author: kazu
Date: Wed Aug 30 06:00:35 2006
New Revision: 116580

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=116580
Log:
        PR middle-end/26632
        * gcc.dg/pr26632.c: New.

Added:
    trunk/gcc/testsuite/gcc.dg/pr26632.c


-- 


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


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

* [Bug middle-end/26632] [4.1 Regression] spurious warning: value computed is not used
  2006-03-10 15:15 [Bug c/26632] New: spurious warning: value computed is not used mattias at virtutech dot se
                   ` (10 preceding siblings ...)
  2006-08-30  6:00 ` [Bug middle-end/26632] [4.1 " kazu at gcc dot gnu dot org
@ 2007-02-14  9:10 ` mmitchel at gcc dot gnu dot org
  2008-07-04 15:23 ` jsm28 at gcc dot gnu dot org
  12 siblings, 0 replies; 14+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2007-02-14  9:10 UTC (permalink / raw)
  To: gcc-bugs



-- 

mmitchel at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|4.1.2                       |4.1.3


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


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

* [Bug middle-end/26632] [4.1 Regression] spurious warning: value computed is not used
  2006-03-10 15:15 [Bug c/26632] New: spurious warning: value computed is not used mattias at virtutech dot se
                   ` (11 preceding siblings ...)
  2007-02-14  9:10 ` mmitchel at gcc dot gnu dot org
@ 2008-07-04 15:23 ` jsm28 at gcc dot gnu dot org
  12 siblings, 0 replies; 14+ messages in thread
From: jsm28 at gcc dot gnu dot org @ 2008-07-04 15:23 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #11 from jsm28 at gcc dot gnu dot org  2008-07-04 15:23 -------
Closing 4.1 branch.


-- 

jsm28 at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
      Known to fail|                            |4.1.3
      Known to work|                            |4.2.0
         Resolution|                            |FIXED
   Target Milestone|4.1.3                       |4.2.0


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


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

end of thread, other threads:[~2008-07-04 15:23 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-03-10 15:15 [Bug c/26632] New: spurious warning: value computed is not used mattias at virtutech dot se
2006-03-10 15:17 ` [Bug middle-end/26632] [4.1/4.2 Regression] " pinskia at gcc dot gnu dot org
2006-03-10 15:17 ` [Bug middle-end/26632] " pinskia at gcc dot gnu dot org
2006-03-10 15:30 ` [Bug middle-end/26632] [4.1/4.2 Regression] " mattias at virtutech dot se
2006-03-11  0:16 ` neil at daikokuya dot co dot uk
2006-04-16 18:58 ` mmitchel at gcc dot gnu dot org
2006-05-25  2:46 ` mmitchel at gcc dot gnu dot org
2006-05-30 13:54 ` pinskia at gcc dot gnu dot org
2006-06-30  6:08 ` pinskia at gcc dot gnu dot org
2006-08-28  6:49 ` pinskia at gcc dot gnu dot org
2006-08-28 17:18 ` kazu at gcc dot gnu dot org
2006-08-30  6:00 ` [Bug middle-end/26632] [4.1 " kazu at gcc dot gnu dot org
2007-02-14  9:10 ` mmitchel at gcc dot gnu dot org
2008-07-04 15:23 ` jsm28 at gcc dot gnu dot org

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