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]

[PATCH 1/2] Fix the unitialized bit in a struct field corresponding to enumb


Without setting this bit, even for a small enumeration types their member fields contain random 0/1's as the values of "artificial". When comparing two instances of exactly the same
enum type, the result depends on whether their members contain the same garbage as the value of artificial.

gdb/ChangeLog:
2017-02-11  Maxim Akhmedov  <max42@yandex-team.ru>

	* dwarf2read.c: fix uninitialized bit in a struct field corresponding
	to enumeration member.

---
 gdb/dwarf2read.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
index 774ed73075..676da14c58 100644
--- a/gdb/dwarf2read.c
+++ b/gdb/dwarf2read.c
@@ -13652,6 +13652,7 @@ process_enumeration_scope (struct die_info *die, struct dwarf2_cu *cu)
                  FIELD_TYPE (fields[num_fields]) = NULL;
                  SET_FIELD_ENUMVAL (fields[num_fields], SYMBOL_VALUE (sym));
                  FIELD_BITSIZE (fields[num_fields]) = 0;
+                 FIELD_ARTIFICIAL (fields[num_fields]) = 0;
 
                  num_fields++;
                }
-- 
2.11.0


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