This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: memcpy / Language Lawyer / optimization question
- From: Steve Ellcey <sje at cup dot hp dot com>
- To: gcc at gcc dot gnu dot org
- Date: Fri, 10 Dec 2004 08:51:24 -0800 (PST)
- Subject: Re: memcpy / Language Lawyer / optimization question
> From: "Joseph S. Myers" <joseph@codesourcery.com>
>
> The casts in the calls to memcpy are irrelevant: the undefined behavior
> occurs before them, at the point where you cast an unaligned pointer to
> int *.
Thanks to everyone for the info on memcpy. I think I have the right fix
for the Fortran library. There is a routine that returns a 'char *' and
that return value was being cast to 'int *' and put into an 'int *'
variable before being passed into memcpy.
If I remove the cast and make the variable a 'char *' then I don't need
any casts in the memcpy call and everything works correctly.
It does looks like 'void *' should have been behaving just like 'char *'
so I will look into that issue some more and either come up with a patch
or submit a PR for the problem.
Steve Ellcey
sje@cup.hp.com