[Dune] [#596] icc warns: pointless comparison of a uint with 0 (Attachment added)

Dune dune at dune-project.org
Fri Sep 11 13:32:27 CEST 2009


THIS IS AN AUTOMATED MESSAGE, DO NOT REPLY.

A new Flyspray task has been opened.  Details are below. 

User who did this - Leonard Kern (kern) 

Attached to Project - Dune
Summary - icc warns: pointless comparison of a uint with 0
Task Type - Bug Report
Category - ISTL
Status - Unconfirmed
Assigned To - 
Operating System - Unspecified / All
Severity - Low
Priority - Normal
Reported Version - SVN
Due in Version - Undecided
Due Date - Undecided
Details - 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: pointless comparison of unsigned integer with zero
  	  if (i.index()-BW1>=0) i.insert(i.index()-BW1);
  	                   ^

example.cc(379): warning #186: 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.

One or more files have been attached.

More information can be found at the following URL:
http://www.dune-project.org/flyspray/index.php?do=details&task_id=596

You are receiving this message because you have requested it from the Flyspray bugtracking system.  If you did not expect this message or don't want to receive mails in future, you can change your notification settings at the URL shown above.




More information about the Dune mailing list