[PATCH v2] tst-memalign.c: Hide memalign from compiler

H.J. Lu hjl.tools@gmail.com
Tue Dec 17 05:53:24 GMT 2024


On Tue, Dec 17, 2024 at 1:12 PM Florian Weimer <fweimer@redhat.com> wrote:
>
> * H. J. Lu:
>
> > +/* NB: Hide memalign from compiler since compiler may optimize it out
> > +   and -1 alignment isn't a power
> > +   of two.  */
> > +__typeof (memalign) *memalign_p = memalign;
>
> Shouldn't the pointer be volatile to really hide things?

I don't think so.  Since memalign_p is a global symbol
which can be modified, compiler doesn't know what
memalign_p will point to when it is called at run-time.

-- 
H.J.


More information about the Libc-alpha mailing list