[PATCH] pthread_cleanup_push macro generates warning when -Wclobbered is set
Paul Eggert
eggert@cs.ucla.edu
Tue Nov 21 05:35:00 GMT 2017
Joseph Myers wrote:
> 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.
I'm with Florian on this. I don't see the warning as being justified.
Basically the warning is saying "Watch out! Since these variables are not
declared to be volatile, they might be trashed by longjmp!" You can work around
such problems by declaring the variables to be volatile.
Here, though, declaring the variables to be volatile would not fix the problem
that you describe. Because a longjmp makes them go out of scope, they become
uninitialized regardless of whether they're declared to be volatile. So the
warning is not appropriate here.
More information about the Libc-alpha
mailing list