This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]