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

Re: [csmith-dev] Char pointers in Unions



Hi Tomyo,

 

Pointer types other than char* are supported as union fields also. They just have a lower chance than char*. The reason I give more chance to char* is we want to do something eventually not in current Csmith yet:

 

union U0

{

char* p1;

int* p2;

} u;

 

int i = 0xffff;

u.p2 = &i;

*(u.p1 + 1) = 2;

 

With this we achieve implicit pointer conversion and we are able to modify only part of the integer. Supposedly this will make the random programs more interesting.

 

-Xuejun

 

 

From: csmith-dev-bounces@flux.utah.edu [mailto:csmith-dev-bounces@flux.utah.edu] On Behalf Of Tomyo Maeshiro
Sent: Friday, August 12, 2011 8:17 AM
To: csmith-dev@flux.utah.edu
Subject: [csmith-dev] Char pointers in Unions

 

Hello

I have a question about unions generation in Csmith.

Is there a particular reason for generating only char pointers as a union field?  Is that correct? Why arent you considering having any other kind of pointers?

Thanks

Tomyo Maeshiro