OMNeT++/OMNEST Bug Tracker - OMNeT++
View Issue Details
0000013OMNeT++simulation kernelpublic2008-12-01 16:082008-12-02 13:41
baumgart 
andras 
normaltrivialalways
resolvedfixed 
4.0b8 
4.0rc1 
0000013: several compile warnings when crosscompiling for ARM
There are several warnings when trying to compile omnetpp-4.0b8 with gcc for ARM with scratchbox:

stringutil.cc: In function `std::string opp_quotestr(const char*)':
stringutil.cc:148: warning: comparison is always true due to limited range
of data type

stringutil.cc: In function `bool opp_needsquotes(const char*)':
stringutil.cc:165: warning: comparison is always true due to limited range
of data type

eventlogentry.cc: In constructor `EventLogEntry::EventLogEntry()':
eventlogentry.cc:35: warning: converting of negative value
`-0x00000000000000001' to `unsigned int'

omnetpp-4.0b8/include/cwatch.h: In member
function `virtual std::string cWatch_char::info() const':
omnetpp-4.0b8/include/cwatch.h:150: warning:
comparison is always true due to limited range of data type

cclassdescriptor.cc: In static member function `static long int
cClassDescriptor::string2enum(const char*, const char*)':
cclassdescriptor.cc:126: warning: comparison is always true due to limited
range of data type

omnetpp-4.0b8/include/cwatch.h: In member
/function `virtual std::string cWatch_char::info() const':
omnetpp-4.0b8/include/cwatch.h:150: warning:
/comparison is always true due to limited range of data type

sim_std_m.cc: In member function `virtual void*
cDensityEstBaseDescriptor::getFieldStructPointer(void*, int, int) const':
sim_std_m.cc:5610: warning: taking address of temporary

No tags attached.
Issue History
2008-12-01 16:08baumgartNew Issue
2008-12-01 18:09rhornigNote Added: 0000035
2008-12-01 18:28rhornigNote Added: 0000038
2008-12-01 18:28rhornigStatusnew => feedback
2008-12-02 09:25baumgartNote Added: 0000041
2008-12-02 10:44rhornigNote Added: 0000042
2008-12-02 10:44rhornigStatusfeedback => confirmed
2008-12-02 11:44andrasNote Added: 0000043
2008-12-02 13:41andrasNote Added: 0000044
2008-12-02 13:41andrasStatusconfirmed => resolved
2008-12-02 13:41andrasFixed in Version => 4.0rc1
2008-12-02 13:41andrasResolutionopen => fixed
2008-12-02 13:41andrasAssigned To => andras
2008-12-05 00:15andrasNote Deleted: 0000043

Notes
(0000035)
rhornig   
2008-12-01 18:09   
Hmm. Interesting. We have never tried to compile it for ARM. Just out of curiosity, why do you need OMNeT++ on ARM?

As for the issue, the "comparison is always true due to limited range of data type" warnings are strange:

r>=0 && r<' ' ? ' ':r

The above line generates the warning. I don't really get how this can happen?
Some googling reveals that ARM has unsigned char types by default, but even in this case the above line should be ok.

ALso found http://gcc.gnu.org/ml/gcc/2006-01/msg00785.html [^]
which seems to be a bug related to this warning in GCC.

What compiler version do you use? It may be a compiler problem.
(0000038)
rhornig   
2008-12-01 18:28   
please check your compiler with a trivial program that compares characters. Does it give the same warning?
(0000041)
baumgart   
2008-12-02 09:25   
We have to crosscompile OMNeT++ on ARM to run OverSim on Nokia N810 Internet tablets (of course only to emulate a single overlay host and not for simulation of large networks).

I don't think this is a gcc bug: char is unsigned by default on ARM. In this case the comparison r>=0 doesn't make sense and should give a warning. Probably you assume char to be signed in your code. Correct fix would be to explicitly use an "signed char".

See also http://www.arm.linux.org.uk/docs/faqs/signedchar.php [^]
(0000042)
rhornig   
2008-12-02 10:44   
You are right. With unsiged char c >= 0 is always true. I was assuming the the compiler gave the warning for the whole expression. Ok we will check this.
(0000044)
andras   
2008-12-02 13:41   
Fixed in the code (except for "taking address of temporary" which will need further attention)