public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/23587] New: Missing "warning: comparison is always false due to limited range of data type"
@ 2005-08-27  0:15 v dot haisman at sh dot cvut dot cz
  2005-08-27  0:22 ` [Bug c/23587] " pinskia at gcc dot gnu dot org
  2005-08-27  2:29 ` pinskia at gcc dot gnu dot org
  0 siblings, 2 replies; 3+ messages in thread
From: v dot haisman at sh dot cvut dot cz @ 2005-08-27  0:15 UTC (permalink / raw)
  To: gcc-bugs

The following test warns about the comparison being always true only for two of
 the six tests:

#include <cstdlib>

void a (unsigned char x)
{
  if (x < 0)
    abort ();
}

void b (unsigned short x)
{
  if (x < 0)
    abort ();
}

void c (unsigned int x)
{
  if (x < 0)
    abort ();
}

void d (unsigned long x)
{
  if (x < 0)
    abort ();
}

void e (unsigned long long x)
{
  if (x < 0)
    abort ();
}

void f (size_t x)
{
  if (x < 0)
    abort ();
}


wilx@logout:::~/tmp> g++ -save-temps -fverbose-asm -O3 -c test.cxx
test.cxx: In function 'void a(unsigned char)':
test.cxx:5: warning: comparison is always false due to limited range of data type
test.cxx: In function 'void b(short unsigned int)':
test.cxx:11: warning: comparison is always false due to limited range of data type


wilx@logout:::~/tmp> g++ -v
Using built-in specs.
Target: i386-unknown-freebsd4.10
Configured with: ../srcdir/configure --disable-nls
--enable-version-specific-runtime-libs --enable-dwarf2 --with-cpu=pentium3
--with-arch=pentium3 --with-system-zlib --disable-shared --prefix=/home/4/wilx
--enable-languages=c,c++,objc,ada --disable-sjlj-exceptions
--enable-shared=libstdc++ --enable-shared=libobjc
Thread model: posix
gcc version 4.1.0 20050821 (experimental)

-- 
           Summary: Missing "warning: comparison is always false due to
                    limited range of data type"
           Product: gcc
           Version: 4.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: v dot haisman at sh dot cvut dot cz
                CC: gcc-bugs at gcc dot gnu dot org,v dot haisman at sh dot
                    cvut dot cz
 GCC build triplet: i386-unknown-freebsd4.10
  GCC host triplet: i386-unknown-freebsd4.10
GCC target triplet: i386-unknown-freebsd4.10


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


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

* [Bug c/23587] Missing "warning: comparison is always false due to limited range of data type"
  2005-08-27  0:15 [Bug c++/23587] New: Missing "warning: comparison is always false due to limited range of data type" v dot haisman at sh dot cvut dot cz
@ 2005-08-27  0:22 ` pinskia at gcc dot gnu dot org
  2005-08-27  2:29 ` pinskia at gcc dot gnu dot org
  1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-08-27  0:22 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|c++                         |c
           Keywords|                            |diagnostic
      Known to work|                            |2.95.3 3.2.3 3.4.0 4.0.0
                   |                            |4.1.0


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


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

* [Bug c/23587] Missing "warning: comparison is always false due to limited range of data type"
  2005-08-27  0:15 [Bug c++/23587] New: Missing "warning: comparison is always false due to limited range of data type" v dot haisman at sh dot cvut dot cz
  2005-08-27  0:22 ` [Bug c/23587] " pinskia at gcc dot gnu dot org
@ 2005-08-27  2:29 ` pinskia at gcc dot gnu dot org
  1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-08-27  2:29 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
      Known to fail|                            |2.95.3 3.2.3 3.4.0 4.0.0
                   |                            |4.1.0
      Known to work|2.95.3 3.2.3 3.4.0 4.0.0    |
                   |4.1.0                       |


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


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

end of thread, other threads:[~2005-08-27  0:22 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-08-27  0:15 [Bug c++/23587] New: Missing "warning: comparison is always false due to limited range of data type" v dot haisman at sh dot cvut dot cz
2005-08-27  0:22 ` [Bug c/23587] " pinskia at gcc dot gnu dot org
2005-08-27  2:29 ` pinskia 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).