public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/37178]  New: false positive with -Wstrict-overflow=2 on code not involving signed overflow
@ 2008-08-20 17:52 edwintorok at gmail dot com
  2008-08-20 17:53 ` [Bug c/37178] " edwintorok at gmail dot com
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: edwintorok at gmail dot com @ 2008-08-20 17:52 UTC (permalink / raw)
  To: gcc-bugs

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 1785 bytes --]

Using gcc version 4.3.1 (Debian 4.3.1-9) on amd64 I get a warning I shouldn't:
$ gcc -O2 -Wstrict-overflow=2 testcase-min.i -c
testcase-min.i: In function ‘cli_scanrar’:
testcase-min.i:40: warning: assuming signed overflow does not occur when
simplifying conditional to constant

At line 40 there is this (ret is int, but  it only gets values assigned, no
arithmetic is performed on it)
if(ret == 2)  ret = 0;

I am attaching the reduced testcase.

More system info:
$ uname -a
Linux lightspeed2 2.6.26-1-amd64 #1 SMP Fri Aug 8 13:17:41 UTC 2008 x86_64
GNU/Linux
$ gcc -v
Using built-in specs.
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Debian 4.3.1-9'
--with-bugurl=file:///usr/share/doc/gcc-4.3/README.Bugs
--enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr --enable-shared
--with-system-zlib --libexecdir=/usr/lib --without-included-gettext
--enable-threads=posix --enable-nls --with-gxx-include-dir=/usr/include/c++/4.3
--program-suffix=-4.3 --enable-clocale=gnu --enable-libstdcxx-debug
--enable-objc-gc --enable-mpfr --enable-cld --enable-checking=release
--build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 4.3.1 (Debian 4.3.1-9)


-- 
           Summary: false positive with -Wstrict-overflow=2 on code not
                    involving signed overflow
           Product: gcc
           Version: 4.3.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: edwintorok at gmail dot com
 GCC build triplet: x86_64-linux-gnu
  GCC host triplet: x86_64-linux-gnu
GCC target triplet: x86_64-linux-gnu


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


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

* [Bug c/37178] false positive with -Wstrict-overflow=2 on code not involving signed overflow
  2008-08-20 17:52 [Bug c/37178] New: false positive with -Wstrict-overflow=2 on code not involving signed overflow edwintorok at gmail dot com
@ 2008-08-20 17:53 ` edwintorok at gmail dot com
  2008-08-21 16:53 ` manu at gcc dot gnu dot org
  2008-08-21 16:55 ` manu at gcc dot gnu dot org
  2 siblings, 0 replies; 4+ messages in thread
From: edwintorok at gmail dot com @ 2008-08-20 17:53 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from edwintorok at gmail dot com  2008-08-20 17:52 -------
Created an attachment (id=16115)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=16115&action=view)
reduced testcase

the testcase is reduced from clamav's scanners.c


-- 


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


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

* [Bug c/37178] false positive with -Wstrict-overflow=2 on code not involving signed overflow
  2008-08-20 17:52 [Bug c/37178] New: false positive with -Wstrict-overflow=2 on code not involving signed overflow edwintorok at gmail dot com
  2008-08-20 17:53 ` [Bug c/37178] " edwintorok at gmail dot com
@ 2008-08-21 16:53 ` manu at gcc dot gnu dot org
  2008-08-21 16:55 ` manu at gcc dot gnu dot org
  2 siblings, 0 replies; 4+ messages in thread
From: manu at gcc dot gnu dot org @ 2008-08-21 16:53 UTC (permalink / raw)
  To: gcc-bugs



-- 

manu at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |manu at gcc dot gnu dot org
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2008-08-21 16:51:54
               date|                            |


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


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

* [Bug c/37178] false positive with -Wstrict-overflow=2 on code not involving signed overflow
  2008-08-20 17:52 [Bug c/37178] New: false positive with -Wstrict-overflow=2 on code not involving signed overflow edwintorok at gmail dot com
  2008-08-20 17:53 ` [Bug c/37178] " edwintorok at gmail dot com
  2008-08-21 16:53 ` manu at gcc dot gnu dot org
@ 2008-08-21 16:55 ` manu at gcc dot gnu dot org
  2 siblings, 0 replies; 4+ messages in thread
From: manu at gcc dot gnu dot org @ 2008-08-21 16:55 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from manu at gcc dot gnu dot org  2008-08-21 16:53 -------
This happens also in trunk.


-- 

manu at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |iant at google dot com
   Last reconfirmed|2008-08-21 16:51:54         |2008-08-21 16:53:46
               date|                            |


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


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

end of thread, other threads:[~2008-08-21 16:55 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-08-20 17:52 [Bug c/37178] New: false positive with -Wstrict-overflow=2 on code not involving signed overflow edwintorok at gmail dot com
2008-08-20 17:53 ` [Bug c/37178] " edwintorok at gmail dot com
2008-08-21 16:53 ` manu at gcc dot gnu dot org
2008-08-21 16:55 ` manu 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).