[PATCH] Fix sometimes-uninitialized warning in gdbscm_value_address

Pedro Alves palves@redhat.com
Thu Sep 21 14:30:00 GMT 2017


On 09/21/2017 02:08 PM, Simon Marchi wrote:

> We can get rid of it with a small refactoring.  I think it's a bit
> cleaner/safer to initialize address with a pessimistic value and assign
> it on success.  Then there's no chance of using it uninitialized.  If I
> understand correctly, the NULL check on res_val was to check whether
> value_addr threw, and that if value_addr returns without throwing, the
> result will never be NULL.  If that's true, we can skip the res_val
> variable.

I think this is fine, though I'm curious about whether marking
value_addr with the returns_nonnull attribute would quiet
the warning.

Thanks,
Pedro Alves



More information about the Gdb-patches mailing list