Hi all, I'm using a version of CIL I recently got from the SVN server. It seems that in the following program: void mysub (unsigned long long i) { if (i < 0x80000000) { puts("lt1"); } // first if (i < 2147483648) { puts("lt2"); } // second } int main() { mysub(0x80000000ULL); // third return 0; } Cil replaces both literals inside the function with "0xffffffff80000000ULL", and the literal inside main with "2147483648ULL". Main is fine, but I believe the first two to be wrong, for possibly different reasons.
The type of the hexadecimal literal, assuming 4 byte ints, should actually be an unsigned int (S6.4.4.1 in N1425) with the value 2147483648. Because it is being compared to an unsigned long long, then by the rules of conversion it should then be cast to unsigned long long for the comparison. The second actually has type long int (or long long, depending on the size of ints/longs), but doesn't fit into the int type. It's value should again be 2147483648. In either case (long int or long long) there should then be a cast to an unsigned long long int, for the comparison. I'm not sure what's going on, or whether there are two bugs. Should I post a bug report? -Chucky ------------------------------------------------------------------------------ This SF.net email is sponsored by Sprint What will you do first with EVO, the first 4G phone? Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first _______________________________________________ CIL-users mailing list CIL-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/cil-users