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

--- Comment #14 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to Christian Prochaska from comment #13)
> I found the "Register non-null side effects properly." commit with git
> bisect while debugging a page fault in the Genode OS framework built with
> GCC 12.2.0. It turned out that a null pointer check which was present before
> this commit is now not present anymore. The C++ code with the null pointer
> check can be found on GitHub:
> 
> https://github.com/genodelabs/genode/blob/
> a84af9a9606450471b8038a35f9b55057efa0850/repos/base-nova/src/lib/base/ipc.
> cc#L71
> 
> This is the implementation of the 'Thread::myself()' function which returns
> a null pointer in some conditions:
> 
> https://github.com/genodelabs/genode/blob/
> a84af9a9606450471b8038a35f9b55057efa0850/repos/base/src/lib/base/
> thread_myself.cc#L22
> 
> I compared the disassembled code from objdump and this part is missing when
> the commit is applied:
> 
> Genode::ipc_call(Genode::Native_capability, Genode::Msgbuf_base&,
> Genode::Msgbuf_base&, unsigned long):
> /.../repos/base-nova/src/lib/base/ipc.cc:71
>     addr_t const manual_rcv_sel = myself ?
> myself->native_thread().client_rcv_sel
>    85f78:   48 83 bd 50 ff ff ff    cmpq   $0x0,-0xb0(%rbp)
>    85f7f:   00
>    85f80:   48 c7 c3 ff ff ff ff    mov    $0xffffffffffffffff,%rbx
>    85f87:   74 1d                   je     85fa6
> <Genode::ipc_call(Genode::Native_capability, Genode::Msgbuf_base&,
> Genode::Msgbuf_base&, unsigned long)
> /.../repos/base-nova/src/lib/base/ipc.cc:71 (discriminator 1)
> 
> Now I'm not sure if the problem is in the Genode code or in GCC. Any ideas?

There was a deferencing of myself before:
Nova::Utcb &utcb = *(Nova::Utcb *)myself->utcb();

Reply via email to