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

Re: [csmith-project/csmith] 717b1c: Fixed a bug related to --no-math64 and --no-longlo...



Can you give a bit of example code for these two cases?

John



On 5/4/11 9:54 PM, Xuejun Yang wrote:
My memory is a little fuzzy on our last conversation about unions. But I think applying these 2 constraints on unions accesses could avoid undefined behaviors caused by padding bits:

1) after writing a field, reading must be through a field of equal or smaller size. i.e., writing to a int field and then reading from a char field is fine, but not the other way around.

2) after writing a struct field, reading must the through the same field.

I think with those we can avoid undefined behaviors without getting into messy details of types. Did I miss anything?

-Xuejun


But you're going to need alignment information for everything to make
unions work, right?

John


On 05/04/2011 06:58 PM, Xuejun Yang wrote:
Yes, if we fix-size integers, the only thing left is pointers. That's why I was
asking. Well, I can fix it to 8 bytes for now if only unions care about it.

-Xuejun

-----Original Message-----
From: csmith-commits-bounces@flux.utah.edu
[mailto:csmith-commits-bounces@flux.utah.edu] On Behalf Of John Regehr
Sent: Wednesday, May 04, 2011 6:53 PM
To: csmith-commits@flux.utah.edu
Subject: Re: [csmith-project/csmith] 717b1c: Fixed a bug related to
--no-math64
and --no-longlo...

Ok sorry to yell.

I grepped for x86_64 and it's not used much, so should be easy to eliminate.

Xuejun: are you going to need size/alignment information to make unions
work?  For example, to avoid accessing padding bytes?

John