[PATCH] Fix dereference of possible nullptr in -O3

Simon Farre simon.farre.cx@gmail.com
Tue May 10 21:00:55 GMT 2022


I see. You're probably right and I think this settles it then. In this
specific case
it triggers only because the function is inlined by the optimizer and as
you previously pointed out
it's sort of strange that the branch prior to it didn't trigger the same
warning,
so it's probably not a useful warning here.

I also checked and changing the signature for the function is not even
remotely
feasible, as there's tons of code essentially relying on it using function
pointers in the `regset`
type, so it makes sense to just leave it alone.

Thanks,
Simon

On Tue, May 10, 2022 at 10:43 PM John Baldwin wrote:

> Warnings like these that are not deterministic are quite annoying.  Also,
> we previously concluded that GDB can't actually use GCC's non-null
> attribute
> on function arguments (which is how you would otherwise work around the
> warning I guess) as the non-null attribute is somewhat broken.  (See
> commit fb6262e8534e0148a4a424e9e5138159af19faf1).  Perhaps the warning
> should simply be disabled via -Wno-nonnull or the like.
>
> --
> John Baldwin
>


More information about the Gdb-patches mailing list