From: Maarten B. <sou...@ds...> - 2013-01-12 16:37:04
|
Hi Vaclav, A warning could be given for comparison of signed and unsigned int. Other compilers do. But they cannot be cast to a larger type as that is not allowed by the C standard. Maarten > Hello, > > I am currently playing with comparison. I found that if I compare char and > uchar, both operands are promoted to int and then compared. This is in > iCode, as well and I am getting message "warning 185: comparison of > 'signed char' with 'unsigned char' requires promotion to int". > > But when I compare int with uint, no warning is printed and int is > silently casted to uint: > sign_compare.c(l23:s12:k15:d0:s0)Â Â Â Â Â Â iTemp8 [k14 lr12:13 so:0]{ > ia0 a2p0 > re0 rm0 nos0 ru0 dp0}{volatile-unsigned-int xdata} := iTemp6 [k12 lr10:12 > so:0]{ ia0 a2p0 re0 rm0 nos0 ru0 dp0}{volatile-int xdata} > sign_compare.c(l23:s13:k16:d0:s0)Â Â Â Â Â Â iTemp9 [k15 lr13:14 so:0]{ > ia0 a2p0 > re0 rm0 nos0 ru0 dp0}{char fixed} = iTemp8 [k14 lr12:13 so:0]{ ia0 a2p0 > re0 > rm0 nos0 ru0 dp0}{volatile-unsigned-int xdata} > iTemp7 [k13 lr11:13 > so:0]{ > ia0 a2p0 re0 rm0 nos0 ru0 dp0}{volatile-unsigned-int xdata} > > Is there any possibility to extend icode generator to cast such operands > to signed 3 bytes and then signed comparison ? And some warning message ? > The same probably applies to long and ulong. > > Shall I create bug report for this issue ? > > Vaclav |