[pushed] Initialize base_value in pascal_object_print_value

Message ID 20200317003600.14703-1-tom@tromey.com
State New
Headers show
Series
  • [pushed] Initialize base_value in pascal_object_print_value
Related show

Commit Message

Tom Tromey March 17, 2020, 12:36 a.m.
The val_print removal series introduced a new possibly-uninitialized
warning in p-valprint.c.  Examination of the code shows that the
warning does not indicate a real bug, so this patch silences the
warning by setting the variable in the catch clause of a try/catch.
(The obvious initialization did not work due to a "goto" in this
function.)

gdb/ChangeLog
2020-03-16  Tom Tromey  <tom@tromey.com>

	* p-valprint.c (pascal_object_print_value): Initialize
	base_value.
---
 gdb/ChangeLog    | 5 +++++
 gdb/p-valprint.c | 1 +
 2 files changed, 6 insertions(+)

-- 
2.17.2

Patch

diff --git a/gdb/p-valprint.c b/gdb/p-valprint.c
index 35a4e59d250..cbd7fb75e24 100644
--- a/gdb/p-valprint.c
+++ b/gdb/p-valprint.c
@@ -739,6 +739,7 @@  pascal_object_print_value (struct value *val, struct ui_file *stream,
 	}
       catch (const gdb_exception_error &ex)
 	{
+	  base_value = nullptr;
 	  if (ex.error == NOT_AVAILABLE_ERROR)
 	    skip = -1;
 	  else