https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104288

--- Comment #17 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to Christian Prochaska from comment #16)
> (In reply to Andrew Pinski from comment #14)
> > 
> > There was a deferencing of myself before:
> > Nova::Utcb &utcb = *(Nova::Utcb *)myself->utcb();
> 
> I see. The 'Thread::utcb()' function handles the null pointer case
> internally with a 'this == 0' check and a local
> '-fno-delete-null-pointer-checks' attribute:
> 
> https://github.com/genodelabs/genode/blob/
> a84af9a9606450471b8038a35f9b55057efa0850/repos/base-nova/src/lib/base/stack.
> cc#L110
> 
> So, the elimination of the 'myself' null pointer check is basically a result
> of undefined behavior with the 'Thread::utcb()' function?

That only handles one side of where it is undefined. Newer GCC uses it as being
undefined even on the calling side. So you need to use
-fno-delete-null-pointer-checks really on the command line or better yet fixes
all of the places which use ->utcb() .

Reply via email to