Jean-Jacques Michel <jjm...@li...> writes:
> Ken Yap a =E9crit :
> >=20
> > >In "rtl_transmit", the variable nstype is updated only AFTER
> > >the memcpy is done !
> > >Moving the "nstype =3D htons(type)" far from the "memcpy" makes
> > >the problem disappear.
> >=20
> > Ok, will patch, many thanks. Will you submit a gcc3 bug report?
>=20
> I don't really know if you can consider this as a GCC bug :
>=20
> If you work with a "char *ptr",
> there is nothing the compiler can know about *ptr when you use ptr
> as a parameter of a function.From my point of view, you cannot blame
> the compiler for this.
Exactly there is nothing the compiler can know so it must
be conservative. The compiler can only take this kind of
action if the types are definenitely different, so they cannot alias.
I haven't explicitly heard about void * but I know it must assume=20
char * pointers can alias with any type.
It might be worth trying with: -fno-strict-aliasing and see
if the problem persists.
Eric
|