This is the mail archive of the gcc-bugs@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]

[Bug middle-end/60092] posix_memalign not recognized to derive alias and alignment info


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60092

--- Comment #8 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
(In reply to Richard Biener from comment #7)
> According to the specification this is wrong.  Note that changing errno
> is hindering optimization.  For example
> 
> int foo (int *p)
> {
>   *p = 1;
>   malloc (4);
>   return *p;
> }
> 
> cannot CSE *p because p may point to errno.  (works for float *p and
> works when using posix_memalign with my patch)

Well, e.g.
http://pubs.opengroup.org/onlinepubs/007904975/functions/posix_memalign.html
says nothing about errno, I think only functions which explicitly document not
to clobber errno may not, all other functions may, but it's value is undefined
after the call.  For calls that are documented to change errno in some cases,
it is again defined only if those calls return a particular value (e.g. -1),
otherwise errno is still undefined.


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