I attach a sample program, a make file, and an svn patch to correct the error demonstrated by the program. After the patch, running the program with an argument of -1 produces this output on my 64-bit Ubuntu system:

./uint -1
sizeof (unsigned long) = 8
foo (atoi (argv[1])) = ffffffffffffffff
foo (-1) = ffffffffffffffff
foo (-1L) = ffffffffffffffff
foo (-1LL) = ffffffffffffffff

Without the patch, running the program produces the following output:

./uint -1
sizeof (unsigned long) = 8
foo (atoi (argv[1])) = ffffffffffffffff
foo (-1) = ffffffff
foo (-1L) = ffffffff
foo (-1LL) = ffffffff

The error occurs in d_const, which assumes that only long long integers are 64 bits and therefore truncates long integers to 32 bits. Since the argument of -1 is handled correctly in both programs, I am assuming that the error occurs only in handling negative literals.

I could have used the test

not (bytesSizeOfInt ik > 4)

instead of

not ((ik = IULong || ik = ILong) && !M.theMachine.M.sizeof_long > 4)

but bytesSizeOfInt is defined later in the file and I didn't want to move it out of the machine-dependent section.

Jesse Draper

Attachment: cilbugrpt2.tar.gz
Description: GNU Zip compressed data

------------------------------------------------------------------------------
The modern datacenter depends on network connectivity to access resources
and provide services. The best practices for maximizing a physical server's
connectivity to a physical network are well understood - see how these
rules translate into the virtual world? 
http://p.sf.net/sfu/oracle-sfdevnlfb
_______________________________________________
CIL-users mailing list
CIL-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/cil-users

Reply via email to