Hrvoje Niksic <hniksic(a)srce.hr> writes:
int f() {
int a;
int *ip;
a = 10;
ip = &a;
return *ip;
}
How is this any different than what is done above?
In this case both objects are of the same type.
float foo;
LispObject f(LispObject *bar)
{
LispObject rval;
foo = 3.0;
rval = *LispObject;
foo = 5.0;
return rval;
}
Here the compiler can remove the first assignment to foo under strict
aliasing because it can assume a LispObject pointer never points to a
float.
> "everybody has fixed their code already because other
compilers have
> been doing this optimization for ages"
If the last is really the case, then we indeed have nothing to worry
about. XEmacs has compiled and run on non-Gcc compilers for ages.
*If* the last is really the case.
Yes, but which of them do this optimization?
Jan