Norcroft unsigned long long brokenness
Jeffrey Lee (213) 6048 posts |
Behold:
With #if 1:
With #if 0:
Stuff also seems to break if you mix the signed & unsigned types (signed long long, unsigned int). I don’t have enough time at the moment to narrow down the precise bits are broken, but needless to say I’m not happy :( (This is running Norcroft with default settings after a clean boot, btw) |
Jeffrey Lee (213) 6048 posts |
Also, if the suspect code is in the SCL: My Iyonix is running 5.54, but my BeagleBoard (which is where I first found the bug) is obviously running the latest – 5.56 |
John-Mark Bell (94) 36 posts |
Looks like the optimiser is unhelpfully optimising out a register initialisation. One workaround would be to disable the peepholer: pass -zpq8 to cc or, perhaps more usefully, surround the function with #pragma -q8 … #pragma -q0. Obviously, this option has both code size and speed implications. It does, however, appear to make the above code produce the correct output with unsigned arithmetic. |
Stephen Leary (372) 272 posts |
I have confirmed that if any divides are done everything starts working by the way. So yes.. looks like optimiser. |
Stephen Leary (372) 272 posts |
try this.
|