[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [csmith-dev] Bug in GCC LP64 targets
signed char g_2 = (-6L);
R = ((g_2 ^ 0U)<= (-4L));
printf("long:%u int:%u R:%d\n", (unsigned)sizeof(long),
All 64-bit versions of GCC I got my hands on print "long:8 int:4 R:1".
It looks like the value propagation is failing to convert the -6L to
There is also a potential bug in Csmith here. A faulty compiler
might replace the last argument to printf with the expression
assigned to R (ie, an optimization) and treat the result as
having type long (ie, a fault).
Depending on the byte/word order of the cpu the top 32-bits of
a 64 bit value, rather than the bottom 32-bits, might be printed.
To be on the safe side, if any expression involved an object or
value having a long type any printf ought to use a long type
modifier to output the value of any associated object that is
Derek M. Jones tel: +44 (0) 1252 520 667
Knowledge Software Ltd mailto:email@example.com
Source code analysis http://www.knosof.co.uk