This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Fix sometimes-uninitialized warning in gdbscm_value_address


On 2017-09-21 16:30, Pedro Alves wrote:
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.

I tried, it didn't.

Thanks for reviewing, the patch is now pushed.

Simon


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]