This is the mail archive of the crossgcc@sources.redhat.com mailing list for the crossgcc project.
See the CrossGCC FAQ for lots more information.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
On Mon, 2004-11-01 at 11:47, Toralf Lund wrote:OK. If you say so. Strange how long you can know a language without noticing those details... But of course, my native compiler (also gcc) will actually warn about "comparison between signed and unsigned", at least with C++ (which I otherwise normally use), so I'll usually insert explicit type conversions when necessary, or otherwise rewrite the code to avoid the warning...
Richard Earnshaw wrote:
No, position is all right. But now that you mention it, ZSTP_MAX_POS is actually set up via an indirect definition involving "sizeof", following a recent update. I guess that makes ZSTP_MAX_POS an unsigned, and if I use an "int" typecast, I do get the correct code. I still don't quite get it, though. Shouldn't -ZSTP_MAX_POS implicitly be treated as a signed in any case? I would at least expect either fully signed or fully unsigned operation; the actual code here seems to be a mixture of bot.So I suspect your problem is the type of one of your arguments, most likely the declaration of position itself.
Negation of an unsigned constant produces an unsigned constant. The
rules for unsigned arithmetic are precise and work on operations being
done modulo the 2^bit-size of the data type (unsigned int in this case):
so -X on an unsigned type is in effect (2^32 - X) on ARM. On top of
this, the rules for a combination of signed and unsigned of the same
bit-size are that the operands are all converted to unsigned first.
------ Want more information? See the CrossGCC FAQ, http://www.objsw.com/CrossGCC/ Want to unsubscribe? Send a note to crossgcc-unsubscribe@sources.redhat.com
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |