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

Reply via email to