This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH] pthread_cleanup_push macro generates warning when -Wclobbered is set
On Wed, 15 Nov 2017, Florian Weimer wrote:
> > As far as the compiler can see, the __sigsetjmp call makes the jmp_buf
> > contents escape, and at any subsequent point (before the function returns
> > or a scope with a variably modified type is left) the function might
> > return again - and if this is when the containing scope has reentered, the
> > warning is meant to warn, not deduce that in fact that case does not
> > occur. Some more precise way of describing the possible times of a second
> > return would be needed to make it valid not to warn.
>
> Still not convinced about this, and what's worse, I don't understand why you
> come to a different conclusion. This shouldn't be a matter of opinion. 8-/
Given that the compiler knows nothing about the semantics of the functions
in question, beyond the returns-twice property of __sigsetjmp, the warning
seems justified to me, in that the second return of __sigsetjmp might
result in undefined behavior from variables being accessed after the
containing block has exited, which is what the warning is about. This is
a matter of heuristics for what possible problematic returns should be
considered by the warning.
--
Joseph S. Myers
joseph@codesourcery.com