Skip to content

#596 icc warns: pointless comparison of a uint with 0

Metadata

Property Value
Reported by Leonard Kern (kern@math.hu-berlin.de)
Reported at Sep 11, 2009 11:32
Type Bug Report
Version Git (pre2.4) [autotools]
Operating System Unspecified / All
Last edited by Oliver Sander (oliver.sander@tu-dresden.de)
Last edited at Apr 25, 2012 18:30
Closed by Oliver Sander (oliver.sander@tu-dresden.de)
Closed at Apr 25, 2012 18:30
Closed in version Unknown
Resolution Won't fix
Comment Thanks for reporting, but this doesn't really seem severe enough to do anything about it.

Description

Hello Dune team!

Compiling dune-istl with Intels icpc (Version 11.1.046) gives a warning for dune/dune-istl/istl/tutorial/example.cc.

make[3]: Entering directory `/home/kern/dune/dune-istl/istl/tutorial' icpc -std=c++0x -DHAVE_CONFIG_H -I. -I../.. -I/home/kern/dune/dune-common -I../.. -DHX_HAS_STDIOSTREAM -I/home/kern/dune/extlib/include/amiramesh -DHX_HAS_STDIOSTREAM -MT example.o -MD -MP -MF .deps/example.Tpo -c -o example.o example.cc example.cc(377): warning #186 (closed): pointless comparison of unsigned integer with zero if (i.index()-BW1>=0) i.insert(i.index()-BW1); ^

example.cc(379): warning #186 (closed): pointless comparison of unsigned integer with zero if (i.index()-BW2>=0) i.insert(i.index()-BW2); ^

mv -f .deps/example.Tpo .deps/example.Po /bin/sh ../../libtool --tag=CXX --mode=link icpc -std=c++0x -I/home/kern/dune/extlib/include/amiramesh -DHX_HAS_STDIOSTREAM -L/home/kern/dune/dune-common/lib -ldunecommon -o example example.o
libtool: link: icpc -std=c++0x -I/home/kern/dune/extlib/include/amiramesh -DHX_HAS_STDIOSTREAM -o example example.o -L/home/kern/dune/dune-common/lib /home/kern/dune/dune-common/lib/.libs/libdunecommon.a -lm make[3]: Leaving directory `/home/kern/dune/dune-istl/istl/tutorial'

As far as I can tell, this warning is legitimate - Dune::ISTLAllocator::size_type is typedef'd as std::size_t which is unsigned. The interesting part is that g++ doesn't warn about that. I've attached a small example illustrating this.

-regards Leonard.

Attachments