On Wed, Oct 12, 2005 at 06:28:24PM -0500, Jeremy Nelson wrote:
> 
> Therefore, I propose making it official policy that epic is not compatable 
> with gcc -O2 because -O2 only works properly on code that conforms to C99's 
> rules about alias safety: epic is a c90 program and does not conform.

You could also use -fno-strict-aliasing to work around this.

> struct s1 { int x,y; };
> struct s2 { int x,y; float f };
> int func (struct s2 *ptr) { ptr->x = 5; }
> int main (void)
> {
>       struct s1 *ptr;
>       struct s2 var;
> 
>       var.x = 1;
>       ptr = (struct s1 *)&var;
>       func(ptr);
>       printf("%d\n", var.x);
> }

There are several things wrong with this example, the most
important is that func() takes a struct s2 * and you pass it a
struct s1 *.


Kurt

 
_______________________________________________
List mailing list
List@epicsol.org
http://epicsol.org/mailman/listinfo/list

Reply via email to