This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH] nptl: Add compiler barrier in nptl/tst-pthread-getattr
On 7/30/19 4:12 AM, Andreas Schwab wrote:
On Jul 30 2019, Florian Weimer <fweimer@redhat.com> wrote:
But we need that uintptr_t value to print the diagnostic anyway. I do
not see what we gain if we move the check of the value into
allocate_and_test. If printing the value is fine according to the C
semantics, using it in computations should be defined, too.
Then I guess it was a dumb suggestion. Sorry.
I don't think it's a dumb suggestion.
It is a pragmatic suggestion, and that's good.
There is the set of things you are allowed to do, and when that set of
operations comes close, semantically speaking, to things which users are
not allowed to do, the compiler is may issue warnings and those
warnings may not be entirely accurate and that could be on purpose.
So while it is fine in theory to return the value of the address and
use it in computations, the compiler may warn again on this kind of
behaviour because it's trying to catch uses of that address as a pointer
and it may give false positives.
Both Andreas and my suggestion are intended to avoid this future
possibility.
Having said that, the only thing I care about *today* is that gcc 10
can be used to build glibc without error. So I want Florian's patch,
which is tested, to go in right now (with an additional comment).
--
Cheers,
Carlos.