This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/26729] New: bogus 'comparison is always 0' message
- From: "apl at alum dot mit dot edu" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 17 Mar 2006 16:47:16 -0000
- Subject: [Bug c++/26729] New: bogus 'comparison is always 0' message
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
trivial function using POD constructors says "comparison is always 0".
If I remove any of the UInt16 constructors, the warning goes away.
This doesn't seem to happen in gcc-4.1.0
typedef unsigned short UInt16;
UInt16 pipe;
UInt16 cmp ()
{
UInt16 answer;
answer =
UInt16((((((pipe & UInt16(0x8800u))))))) == UInt16(0x8000u)
& ((((((pipe & 0x4000)!= 0)
? (((((((((pipe & 0x2000u)!= 0))))
&(((((((pipe & 0x400u)!= 0))
?(((((((((((pipe & 0x1001u)))))
^ 0x1000u))) != 0)))
:(((((((((pipe & 0x1001u))))) == 0x1001u))))))))))))
// Next line is reported as always false
:((((UInt16((((((pipe & 0x3700u)))))) == UInt16(0x3000u)))))))));
return answer;
}
--
Summary: bogus 'comparison is always 0' message
Product: gcc
Version: 3.4.3
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: apl at alum dot mit dot edu
GCC build triplet: i686-pc-linux-gnu
GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=26729