* dwarf.c (read_attribute): Always clear val.
authorIan Lance Taylor <iant@google.com>
Tue, 20 Nov 2012 17:28:05 +0000 (17:28 +0000)
committerIan Lance Taylor <ian@gcc.gnu.org>
Tue, 20 Nov 2012 17:28:05 +0000 (17:28 +0000)
From-SVN: r193670

libbacktrace/ChangeLog
libbacktrace/dwarf.c

index fc5871ad30dedb98c56549c1aec60d3f7d3552e1..7d2cfda88b9c7f59ac42b731bac1e49032099849 100644 (file)
@@ -1,3 +1,7 @@
+2012-11-20  Ian Lance Taylor  <iant@google.com>
+
+       * dwarf.c (read_attribute): Always clear val.
+
 2012-11-13  Ian Lance Taylor  <iant@google.com>
 
        PR other/55312
index b198dea38dc8ddfcda8b782a981dc31830491bc0..bd7419b9c9af08e45031b577a7a5a6ba79879c11 100644 (file)
@@ -654,6 +654,12 @@ read_attribute (enum dwarf_form form, struct dwarf_buf *buf,
                const unsigned char *dwarf_str, size_t dwarf_str_size,
                struct attr_val *val)
 {
+  /* Avoid warnings about val.u.FIELD may be used uninitialized if
+     this function is inlined.  The warnings aren't valid but can
+     occur because the different fields are set and used
+     conditionally.  */
+  memset (val, 0, sizeof *val);
+
   switch (form)
     {
     case DW_FORM_addr: