summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2019-04-29 09:17:05 +0930
committerAndreas K. Hüttel <dilfridge@gentoo.org>2019-06-03 07:16:56 +0200
commitd0e8eb0485af1ffd0a76faf9a13827d3c9fbb342 (patch)
tree7a4781fb43781777e6731d3c3c84e56ed149b792
parentAArch64: When DF_BIND_NOW don't use TLSDESC GOT value. (diff)
downloadbinutils-gdb-d0e8eb0485af1ffd0a76faf9a13827d3c9fbb342.tar.gz
binutils-gdb-d0e8eb0485af1ffd0a76faf9a13827d3c9fbb342.tar.bz2
binutils-gdb-d0e8eb0485af1ffd0a76faf9a13827d3c9fbb342.zip
Work around gcc9 warning bug
* wrstabs.c (stab_start_class_type): Add assert to work around gcc9 warning. Tidy. (cherry picked from commit 8107ddcea1da07f1c4e902c17f045684beb78079) (cherry picked from commit 3439fdd6f375c9fca29d4f501202bebaec3867c5) Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>
-rw-r--r--binutils/ChangeLog7
-rw-r--r--binutils/wrstabs.c22
2 files changed, 16 insertions, 13 deletions
diff --git a/binutils/ChangeLog b/binutils/ChangeLog
index 3b80f0dca78..343df75c309 100644
--- a/binutils/ChangeLog
+++ b/binutils/ChangeLog
@@ -1,3 +1,10 @@
+2019-05-13 Alan Modra <amodra@gmail.com>
+
+ Apply from master.
+ 2019-04-30 Alan Modra <amodra@gmail.com>
+ * wrstabs.c (stab_start_class_type): Add assert to work around
+ gcc9 warning. Tidy.
+
2019-04-01 Tamar Christina <tamar.christina@arm.com>
Backport from mainline.
diff --git a/binutils/wrstabs.c b/binutils/wrstabs.c
index 3d1839f131e..3e941dcefd5 100644
--- a/binutils/wrstabs.c
+++ b/binutils/wrstabs.c
@@ -1440,18 +1440,15 @@ stab_end_struct_type (void *p)
/* Start outputting a class. */
static bfd_boolean
-stab_start_class_type (void *p, const char *tag, unsigned int id, bfd_boolean structp, unsigned int size, bfd_boolean vptr, bfd_boolean ownvptr)
+stab_start_class_type (void *p, const char *tag, unsigned int id,
+ bfd_boolean structp, unsigned int size,
+ bfd_boolean vptr, bfd_boolean ownvptr)
{
struct stab_write_handle *info = (struct stab_write_handle *) p;
- bfd_boolean definition;
- char *vstring;
+ bfd_boolean definition = FALSE;
+ char *vstring = NULL;
- if (! vptr || ownvptr)
- {
- definition = FALSE;
- vstring = NULL;
- }
- else
+ if (vptr && !ownvptr)
{
definition = info->type_stack->definition;
vstring = stab_pop_type (info);
@@ -1472,17 +1469,16 @@ stab_start_class_type (void *p, const char *tag, unsigned int id, bfd_boolean st
}
else
{
+ assert (vstring);
vtable = (char *) xmalloc (strlen (vstring) + 3);
sprintf (vtable, "~%%%s", vstring);
free (vstring);
+ if (definition)
+ info->type_stack->definition = TRUE;
}
-
info->type_stack->vtable = vtable;
}
- if (definition)
- info->type_stack->definition = TRUE;
-
return TRUE;
}