[PATCH] Fix dereference of possible nullptr in -O3

John Baldwin jhb@FreeBSD.org
Tue May 10 20:43:00 GMT 2022


On 5/10/22 12:09 PM, Simon Farre wrote:
> If it were up to me, I would probably agree with you there. The reason why
> I submitted the patch
> is that without it, aggressive inlining is refused by -Werror-nonnull (I
> think it's called).
> 
> Since the compiler did not complain about the other branch I suspect that
> it was not able
> to aggressively optimize that branch in the same fashion.

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