For this code: unsigned foo(unsigned a) { unsigned l; l = (a >= (~0u - 512) ? (~0u - 512) : a); return l; }
At any optimization level, including -O0, -O1 and -O2, you get (at varying lines, of course): x.s: Assembler messages: x.s:14: Error: Immediate value not in 8 bit range: -513 The offending asm is: bound.b -513,$r9 where the -513 operand is clearly not in the range (signed+unsigned) -128..255. I can trace this back to (a modified version of) gcc-3.2. -- Summary: invalid assembly for unsigned-minimum expressions. Product: gcc Version: 4.2.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: target AssignedTo: hp at gcc dot gnu dot org ReportedBy: hp at gcc dot gnu dot org GCC target triplet: cris-*-* http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25718