OMNeT++/OMNEST Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0000013OMNeT++simulation kernelpublic2008-12-01 16:082008-12-02 13:41
Reporterbaumgart 
Assigned Toandras 
PrioritynormalSeveritytrivialReproducibilityalways
StatusresolvedResolutionfixed 
PlatformOSOS Version
Product Version4.0b8 
Target VersionFixed in Version4.0rc1 
Summary0000013: several compile warnings when crosscompiling for ARM
DescriptionThere 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

TagsNo tags attached.
Attached Files

- Relationships

-  Notes
(0000035)
rhornig (administrator)
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 (administrator)
2008-12-01 18:28

please check your compiler with a trivial program that compares characters. Does it give the same warning?
(0000041)
baumgart (reporter)
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 (administrator)
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 (administrator)
2008-12-02 13:41

Fixed in the code (except for "taking address of temporary" which will need further attention)

- Issue History
Date Modified Username Field Change
2008-12-01 16:08 baumgart New Issue
2008-12-01 18:09 rhornig Note Added: 0000035
2008-12-01 18:28 rhornig Note Added: 0000038
2008-12-01 18:28 rhornig Status new => feedback
2008-12-02 09:25 baumgart Note Added: 0000041
2008-12-02 10:44 rhornig Note Added: 0000042
2008-12-02 10:44 rhornig Status feedback => confirmed
2008-12-02 11:44 andras Note Added: 0000043
2008-12-02 13:41 andras Note Added: 0000044
2008-12-02 13:41 andras Status confirmed => resolved
2008-12-02 13:41 andras Fixed in Version => 4.0rc1
2008-12-02 13:41 andras Resolution open => fixed
2008-12-02 13:41 andras Assigned To => andras
2008-12-05 00:15 andras Note Deleted: 0000043


Copyright © 2000 - 2019 MantisBT Team
Powered by Mantis Bugtracker