[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [csmith-dev] unsigned compares not supported

On Wed, Jul 20, 2011 at 7:33 PM, John Regehr <regehr@cs.utah.edu> wrote:
> Hi Tomyo,
> On 7/20/2011 6:39 PM, Tomyo Maeshiro wrote:
>> I need to generate programs for a compiler that doesn't support unsigned
>> comparisons. Is there a way to deal with that in csmith?
> Xuejun might be able to add this, but on the other hand he is very busy
> writing his thesis these days.

AFAIK, it should be just a matter of printing "((signed)e1 <
(signed)e2)" everywhere you'd normally print "(e1 < e2)". That place
should be easier to find than it is, though. :P  I think the printing
code for this case is located in FunctionInvocationBinary::Output() or
one of its callees.  Alternatively, it might be possible to modify
random expression generator so that unsigned expressions are not
considered valid operands to comparison operators.  I think that code
is located somewhere inside FunctionInvocation::make_random_binary(),
but lots of luck with that.

(I've been meaning to hack on Csmith a lot more than I actually have.
I forked it on Github a long time ago, but after that first short
burst, every time I start looking at it I get bogged down in
complexity almost immediately.)

> What kind of C compiler doesn't support unsigned comparisons?

For what it's worth, I'm wondering the same thing.

Does this compiler perhaps not support unsigned types at all?  If so,
could you simply "typedef uint32_t int32_t;" etc. in the boilerplate?
Or hack Csmith to completely avoid generating unsigned types at all?
---maybe that's easier than hacking out unsigned comparisons