diff options
author | Tom de Vries <tdevries@suse.de> | 2021-09-27 14:10:39 +0200 |
---|---|---|
committer | Tom de Vries <tdevries@suse.de> | 2021-09-27 14:10:39 +0200 |
commit | 7f92ed6b41c441ab2111c9f1212cbbc13222edcc (patch) | |
tree | a710067f83d4d11fd690a7cfc0d305e2689b2400 /gdb | |
parent | fde1a9a3ee8c95bb7bae6c764755bcbffdbb0308 (diff) | |
download | binutils-7f92ed6b41c441ab2111c9f1212cbbc13222edcc.zip binutils-7f92ed6b41c441ab2111c9f1212cbbc13222edcc.tar.gz binutils-7f92ed6b41c441ab2111c9f1212cbbc13222edcc.tar.bz2 |
[gdb/build] Fix build with g++-4.8
When building g++-4.8, we run into:
...
src/gdb/dwarf2/read.c:919:5: error: multiple fields in union \
'partial_die_info::<anonymous union>' initialized
...
This is due to:
...
union
{
struct
{
CORE_ADDR lowpc = 0;
CORE_ADDR highpc = 0;
};
ULONGEST ranges_offset;
};
...
The error looks incorrect, given that only one union member is initialized,
and does not reproduce with newer g++.
Nevertheless, work around this by moving the initialization to a constructor.
[ I considered just removing the initialization, with the idea that access
should be guarded by has_pc_info, but I ran into one failure in the testsuite,
for gdb.base/check-psymtab.exp due to add_partial_symbol using lowpc without
checking has_pc_info. ]
Tested on x86_64-linux.
Diffstat (limited to 'gdb')
-rw-r--r-- | gdb/dwarf2/read.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c index d2501c9..00aa64d 100644 --- a/gdb/dwarf2/read.c +++ b/gdb/dwarf2/read.c @@ -920,8 +920,8 @@ struct partial_die_info : public allocate_on_obstack /* If HAS_PC_INFO, the PC range associated with this DIE. */ struct { - CORE_ADDR lowpc = 0; - CORE_ADDR highpc = 0; + CORE_ADDR lowpc; + CORE_ADDR highpc; }; /* If HAS_RANGE_INFO, the ranges offset associated with this DIE. */ ULONGEST ranges_offset; @@ -974,6 +974,10 @@ struct partial_die_info : public allocate_on_obstack is_dwz = 0; spec_is_dwz = 0; canonical_name = 0; + /* Don't set these using NSDMI (Non-static data member initialisation), + because g++-4.8 will error out. */ + lowpc = 0; + highpc = 0; } }; |