From: Andreas Arnez <arnez@linux.vnet.ibm.com>
To: Jan Kratochvil <jan.kratochvil@redhat.com>
Cc: gdb-patches@sourceware.org, Victor Leschuk <vleschuk@accesssoftek.com>
Subject: Re: [PATCH v2 4/8] DWARF-5 basic functionality
Date: Tue, 21 Feb 2017 19:18:00 -0000 [thread overview]
Message-ID: <m3wpcjl5df.fsf@oc1027705133.ibm.com> (raw)
In-Reply-To: <148753970532.4016.14210350935498491454.stgit@host1.jankratochvil.net> (Jan Kratochvil's message of "Sun, 19 Feb 2017 22:28:25 +0100")
On Sun, Feb 19 2017, Jan Kratochvil wrote:
[...]
> diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
> index a987e0e..063f463 100644
> --- a/gdb/dwarf2read.c
> +++ b/gdb/dwarf2read.c
[...]
> @@ -4699,8 +4775,8 @@ create_debug_type_hash_table (struct dwo_file *dwo_file,
> dwo_tu = NULL;
> sig_type = OBSTACK_ZALLOC (&objfile->objfile_obstack,
> struct signatured_type);
> - sig_type->signature = signature;
> - sig_type->type_offset_in_tu = type_offset_in_tu;
> + sig_type->signature = header.signature;
> + sig_type->type_offset_in_tu = header.type_offset_in_tu;
> sig_type->per_cu.objfile = objfile;
> sig_type->per_cu.is_debug_types = 1;
> sig_type->per_cu.section = section;
When I compile with "-O3", GCC now yields warnings for the two changed
lines above:
[...] warning: ‘header.comp_unit_head::type_offset_in_tu.cu_offset::cu_off’
may be used uninitialized in this function [-Wmaybe-uninitialized]
sig_type->type_offset_in_tu = header.type_offset_in_tu;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
[...] warning: ‘header.comp_unit_head::signature’ may be used
uninitialized in this function [-Wmaybe-uninitialized]
sig_type->signature = header.signature;
~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~
I *think* GCC is wrong. From what I understand, we can only get here if
header.unit_type == DW_UT_type, and then these fields should have been
initialized in read_comp_unit_head before (right?). But then I wonder
about the effect of the call to create_debug_type_hash_table in
create_all_type_units:
create_debug_type_hash_table (NULL, &dwarf2_per_objfile->info, types_htab,
rcuh_kind::COMPILE);
Is that needed? If not, can we drop section_kind as a parameter to
create_debug_type_hash_table? When doing so (see untested patch below),
the warnings go away.
--
Andreas
-- >8 --
diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
index 8a6e1f3..94f5bac 100644
--- a/gdb/dwarf2read.c
+++ b/gdb/dwarf2read.c
@@ -4687,8 +4687,7 @@ add_signatured_type_cu_to_table (void **slot, void *datum)
static void
create_debug_type_hash_table (struct dwo_file *dwo_file,
- dwarf2_section_info *section, htab_t &types_htab,
- rcuh_kind section_kind)
+ dwarf2_section_info *section, htab_t &types_htab)
{
struct objfile *objfile = dwarf2_per_objfile->objfile;
struct dwarf2_section_info *abbrev_section;
@@ -4735,7 +4734,8 @@ create_debug_type_hash_table (struct dwo_file *dwo_file,
table, but we don't need anything else just yet. */
ptr = read_and_check_comp_unit_head (&header, section,
- abbrev_section, ptr, section_kind);
+ abbrev_section, ptr,
+ rcuh_kind::TYPE);
length = get_cu_length (&header);
@@ -4847,8 +4847,7 @@ create_debug_types_hash_table (struct dwo_file *dwo_file,
for (ix = 0;
VEC_iterate (dwarf2_section_info_def, types, ix, section);
++ix)
- create_debug_type_hash_table (dwo_file, section, types_htab,
- rcuh_kind::TYPE);
+ create_debug_type_hash_table (dwo_file, section, types_htab);
}
/* Create the hash table of all entries in the .debug_types section,
@@ -4862,8 +4861,6 @@ create_all_type_units (struct objfile *objfile)
htab_t types_htab = NULL;
struct signatured_type **iter;
- create_debug_type_hash_table (NULL, &dwarf2_per_objfile->info, types_htab,
- rcuh_kind::COMPILE);
create_debug_types_hash_table (NULL, dwarf2_per_objfile->types, types_htab);
if (types_htab == NULL)
{
next prev parent reply other threads:[~2017-02-21 19:18 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-02-19 21:28 [PATCH v2 1/8] Code cleanup: Split create_debug_types_hash_table Jan Kratochvil
2017-02-19 21:28 ` [PATCH v2 2/8] Code cleanup: Split dwarf2_ranges_read to a callback Jan Kratochvil
2017-02-20 20:06 ` [commit] " Jan Kratochvil
2017-02-19 21:28 ` [PATCH v2 6/8] DWARF-5: Macros Jan Kratochvil
2017-02-20 20:08 ` [commit] " Jan Kratochvil
2017-02-19 21:28 ` [PATCH v2 7/8] DWARF-5: DW_FORM_data16 Jan Kratochvil
2017-02-20 20:09 ` [commit] " Jan Kratochvil
2017-02-19 21:28 ` [PATCH v2 4/8] DWARF-5 basic functionality Jan Kratochvil
2017-02-21 19:18 ` Andreas Arnez [this message]
2017-02-22 14:29 ` Jan Kratochvil
2017-02-22 17:38 ` Andreas Arnez
2017-02-22 18:32 ` Jan Kratochvil
2017-02-23 16:59 ` Andreas Arnez
2017-02-24 12:57 ` [patch] DWARF-5: Initialization due to a false compiler warning [Re: [PATCH v2 4/8] DWARF-5 basic functionality] Jan Kratochvil
2017-02-26 15:56 ` [commit] " Jan Kratochvil
2017-02-19 21:28 ` [PATCH v2 3/8] Code cleanup: Refactor abbrev_table_read_table cycle Jan Kratochvil
2017-02-20 20:06 ` [commit] " Jan Kratochvil
2017-02-19 21:28 ` [PATCH v2 5/8] DWARF-5: call sites Jan Kratochvil
2017-02-20 3:31 ` Eli Zaretskii
2017-02-20 20:08 ` [commit] " Jan Kratochvil
2017-02-19 21:28 ` [PATCH v2 8/8] DWARF-5: NEWS Jan Kratochvil
2017-02-20 3:31 ` Eli Zaretskii
2017-02-20 20:09 ` [commit] " Jan Kratochvil
2017-02-20 20:05 ` [commit] [PATCH v2 1/8] Code cleanup: Split create_debug_types_hash_table Jan Kratochvil
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=m3wpcjl5df.fsf@oc1027705133.ibm.com \
--to=arnez@linux.vnet.ibm.com \
--cc=gdb-patches@sourceware.org \
--cc=jan.kratochvil@redhat.com \
--cc=vleschuk@accesssoftek.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).