public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/38470]  New: Feature request: smarter signed/unsigned warning
@ 2008-12-10 10:35 m dot j dot thayer at googlemail dot com
  2008-12-10 10:38 ` [Bug c/38470] " m dot j dot thayer at googlemail dot com
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: m dot j dot thayer at googlemail dot com @ 2008-12-10 10:35 UTC (permalink / raw)
  To: gcc-bugs

This is a request to drop the signed/unsigned comparison warning if the
compiler can clearly see that the unsigned value is positive.  E.g. in the
following case:

if (foo >= 0 && foo < sizeof(bar)) ...

This would avoid the need for a typecase.  Please correct me if this is still
not safe for other reasons.


-- 
           Summary: Feature request: smarter signed/unsigned warning
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: m dot j dot thayer at googlemail dot com


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


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

* [Bug c/38470] Feature request: smarter signed/unsigned warning
  2008-12-10 10:35 [Bug c/38470] New: Feature request: smarter signed/unsigned warning m dot j dot thayer at googlemail dot com
@ 2008-12-10 10:38 ` m dot j dot thayer at googlemail dot com
  2010-02-24 13:16 ` manu at gcc dot gnu dot org
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: m dot j dot thayer at googlemail dot com @ 2008-12-10 10:38 UTC (permalink / raw)
  To: gcc-bugs



-- 

m dot j dot thayer at googlemail dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|normal                      |enhancement


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


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

* [Bug c/38470] Feature request: smarter signed/unsigned warning
  2008-12-10 10:35 [Bug c/38470] New: Feature request: smarter signed/unsigned warning m dot j dot thayer at googlemail dot com
  2008-12-10 10:38 ` [Bug c/38470] " m dot j dot thayer at googlemail dot com
@ 2010-02-24 13:16 ` manu at gcc dot gnu dot org
  2010-02-24 13:17 ` manu at gcc dot gnu dot org
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: manu at gcc dot gnu dot org @ 2010-02-24 13:16 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from manu at gcc dot gnu dot org  2010-02-24 13:16 -------
We need a complete testcase.


-- 

manu at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |manu at gcc dot gnu dot org
             Status|UNCONFIRMED                 |WAITING


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


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

* [Bug c/38470] Feature request: smarter signed/unsigned warning
  2008-12-10 10:35 [Bug c/38470] New: Feature request: smarter signed/unsigned warning m dot j dot thayer at googlemail dot com
  2008-12-10 10:38 ` [Bug c/38470] " m dot j dot thayer at googlemail dot com
  2010-02-24 13:16 ` manu at gcc dot gnu dot org
@ 2010-02-24 13:17 ` manu at gcc dot gnu dot org
  2010-02-24 14:00 ` paolo dot carlini at oracle dot com
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: manu at gcc dot gnu dot org @ 2010-02-24 13:17 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from manu at gcc dot gnu dot org  2010-02-24 13:16 -------
We need a complete testcase. See http://gcc.gnu.org/bugs


-- 


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


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

* [Bug c/38470] Feature request: smarter signed/unsigned warning
  2008-12-10 10:35 [Bug c/38470] New: Feature request: smarter signed/unsigned warning m dot j dot thayer at googlemail dot com
                   ` (2 preceding siblings ...)
  2010-02-24 13:17 ` manu at gcc dot gnu dot org
@ 2010-02-24 14:00 ` paolo dot carlini at oracle dot com
  2010-02-24 14:04 ` [Bug c/38470] dataflow would improve -Wsign-compare manu at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: paolo dot carlini at oracle dot com @ 2010-02-24 14:00 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from paolo dot carlini at oracle dot com  2010-02-24 13:59 -------
I think submitter ask for something like this:

int f(int foo, double bar)
{
  if (foo >= 0 && foo < sizeof(bar))
    return 1;
  return foo;
}

to not warn with -Wsign-compare.


-- 

paolo dot carlini at oracle dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|WAITING                     |NEW
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2010-02-24 13:59:45
               date|                            |


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


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

* [Bug c/38470] dataflow would improve -Wsign-compare
  2008-12-10 10:35 [Bug c/38470] New: Feature request: smarter signed/unsigned warning m dot j dot thayer at googlemail dot com
                   ` (3 preceding siblings ...)
  2010-02-24 14:00 ` paolo dot carlini at oracle dot com
@ 2010-02-24 14:04 ` manu at gcc dot gnu dot org
  2010-02-24 14:07 ` m dot j dot thayer at googlemail dot com
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: manu at gcc dot gnu dot org @ 2010-02-24 14:04 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from manu at gcc dot gnu dot org  2010-02-24 14:03 -------
(In reply to comment #3)
> I think submitter ask for something like this:
[snip]
> to not warn with -Wsign-compare.

That would be nice, but it would require moving the warning to the middle-end
or some form of dataflow in the front-end. And no one is working on either, so
don't hold your breath.



-- 

manu at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|Feature request: smarter    |dataflow would improve -
                   |signed/unsigned warning     |Wsign-compare


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


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

* [Bug c/38470] dataflow would improve -Wsign-compare
  2008-12-10 10:35 [Bug c/38470] New: Feature request: smarter signed/unsigned warning m dot j dot thayer at googlemail dot com
                   ` (4 preceding siblings ...)
  2010-02-24 14:04 ` [Bug c/38470] dataflow would improve -Wsign-compare manu at gcc dot gnu dot org
@ 2010-02-24 14:07 ` m dot j dot thayer at googlemail dot com
  2010-02-24 14:11 ` [Bug c/38470] value range propagation (VRP) " manu at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: m dot j dot thayer at googlemail dot com @ 2010-02-24 14:07 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from m dot j dot thayer at googlemail dot com  2010-02-24 14:07 -------
Comment 3 describes what I meant.  And re comment 4, it is a "would be nice to
have", obviously if it is too much pain to do then such is life.  Thanks in any
case.


-- 


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


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

* [Bug c/38470] value range propagation (VRP) would improve -Wsign-compare
  2008-12-10 10:35 [Bug c/38470] New: Feature request: smarter signed/unsigned warning m dot j dot thayer at googlemail dot com
                   ` (5 preceding siblings ...)
  2010-02-24 14:07 ` m dot j dot thayer at googlemail dot com
@ 2010-02-24 14:11 ` manu at gcc dot gnu dot org
  2010-02-24 14:13 ` manu at gcc dot gnu dot org
  2010-02-24 14:17 ` m dot j dot thayer at googlemail dot com
  8 siblings, 0 replies; 10+ messages in thread
From: manu at gcc dot gnu dot org @ 2010-02-24 14:11 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from manu at gcc dot gnu dot org  2010-02-24 14:11 -------
Fixing this is even more unlikely than fixing PR 23608, since the latter only
asks for constant propagation, but this one requires value range propagation.


-- 

manu at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  BugsThisDependsOn|                            |23608
            Summary|dataflow would improve -    |value range propagation
                   |Wsign-compare               |(VRP) would improve -Wsign-
                   |                            |compare


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


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

* [Bug c/38470] value range propagation (VRP) would improve -Wsign-compare
  2008-12-10 10:35 [Bug c/38470] New: Feature request: smarter signed/unsigned warning m dot j dot thayer at googlemail dot com
                   ` (6 preceding siblings ...)
  2010-02-24 14:11 ` [Bug c/38470] value range propagation (VRP) " manu at gcc dot gnu dot org
@ 2010-02-24 14:13 ` manu at gcc dot gnu dot org
  2010-02-24 14:17 ` m dot j dot thayer at googlemail dot com
  8 siblings, 0 replies; 10+ messages in thread
From: manu at gcc dot gnu dot org @ 2010-02-24 14:13 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from manu at gcc dot gnu dot org  2010-02-24 14:12 -------
(In reply to comment #5)
> Comment 3 describes what I meant.  And re comment 4, it is a "would be nice to
> have", obviously if it is too much pain to do then such is life.  Thanks in any
> case.

Please, do not understand me wrong. I totally agree it would be nice to have
and we should leave this open in case someone steps up to the task (patches
welcome, as they say). I was just commenting that you should not expect a quick
fix because it is more complex than it seems. And thanks for the report.


-- 


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


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

* [Bug c/38470] value range propagation (VRP) would improve -Wsign-compare
  2008-12-10 10:35 [Bug c/38470] New: Feature request: smarter signed/unsigned warning m dot j dot thayer at googlemail dot com
                   ` (7 preceding siblings ...)
  2010-02-24 14:13 ` manu at gcc dot gnu dot org
@ 2010-02-24 14:17 ` m dot j dot thayer at googlemail dot com
  8 siblings, 0 replies; 10+ messages in thread
From: m dot j dot thayer at googlemail dot com @ 2010-02-24 14:17 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #8 from m dot j dot thayer at googlemail dot com  2010-02-24 14:16 -------
Of course.  I asked this without knowing much about compiler internals, but I
do have experience of users asking for "little" features which would involve
somewhat more work than they would like to think :)


-- 


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


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

end of thread, other threads:[~2010-02-24 14:17 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-12-10 10:35 [Bug c/38470] New: Feature request: smarter signed/unsigned warning m dot j dot thayer at googlemail dot com
2008-12-10 10:38 ` [Bug c/38470] " m dot j dot thayer at googlemail dot com
2010-02-24 13:16 ` manu at gcc dot gnu dot org
2010-02-24 13:17 ` manu at gcc dot gnu dot org
2010-02-24 14:00 ` paolo dot carlini at oracle dot com
2010-02-24 14:04 ` [Bug c/38470] dataflow would improve -Wsign-compare manu at gcc dot gnu dot org
2010-02-24 14:07 ` m dot j dot thayer at googlemail dot com
2010-02-24 14:11 ` [Bug c/38470] value range propagation (VRP) " manu at gcc dot gnu dot org
2010-02-24 14:13 ` manu at gcc dot gnu dot org
2010-02-24 14:17 ` m dot j dot thayer at googlemail dot com

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