diff options
author | Alan Modra <amodra@gmail.com> | 2020-08-25 09:57:58 +0930 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2020-08-25 23:06:50 +0930 |
commit | ca159256b4eb2c3bf245aef7f05a24fcc1ca6d9b (patch) | |
tree | eb731a8d41fb0dd2565ab02a2ffe3fafd9cb2cb9 | |
parent | 8d3035466746825cd5909cf045cf841222989ec6 (diff) | |
download | gdb-ca159256b4eb2c3bf245aef7f05a24fcc1ca6d9b.zip gdb-ca159256b4eb2c3bf245aef7f05a24fcc1ca6d9b.tar.gz gdb-ca159256b4eb2c3bf245aef7f05a24fcc1ca6d9b.tar.bz2 |
gas warning fixes
Some versions of gcc with -Werror=format-overflow complain about using
a perfectly good 7 char buffer for "r%dr%d" when the int is between 0
and 64, apparently not seeing the value range.
note: __builtin___sprintf_chk output between 5 and 24 bytes into a destination of size 7
* config/tc-arc.c (declare_register_set): Avoid false positive
format-overflow warning.
* config/tc-epiphany.c (md_assemble): Likewise.
* config/tc-mips.c (md_begin): Likewise.
* config/tc-mmix.c (mmix_md_begin): Likewise.
* config/tc-nds32.c (nds32_elf_append_relax_relocs): Avoid false
positive "may be used uninitialized" warning.
-rw-r--r-- | gas/ChangeLog | 10 | ||||
-rw-r--r-- | gas/config/tc-arc.c | 2 | ||||
-rw-r--r-- | gas/config/tc-epiphany.c | 4 | ||||
-rw-r--r-- | gas/config/tc-mips.c | 2 | ||||
-rw-r--r-- | gas/config/tc-mmix.c | 2 | ||||
-rw-r--r-- | gas/config/tc-nds32.c | 1 |
6 files changed, 16 insertions, 5 deletions
diff --git a/gas/ChangeLog b/gas/ChangeLog index b6f4edd..f8d049b 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,3 +1,13 @@ +2020-08-25 Alan Modra <amodra@gmail.com> + + * config/tc-arc.c (declare_register_set): Avoid false positive + format-overflow warning. + * config/tc-epiphany.c (md_assemble): Likewise. + * config/tc-mips.c (md_begin): Likewise. + * config/tc-mmix.c (mmix_md_begin): Likewise. + * config/tc-nds32.c (nds32_elf_append_relax_relocs): Avoid false + positive "may be used uninitialized" warning. + 2020-08-24 Cooper Qu <cooper.qu@linux.alibaba.com> * config/tc-csky.c (csky_archs): Add item for CK860, diff --git a/gas/config/tc-arc.c b/gas/config/tc-arc.c index 32369a5..bafa2a5 100644 --- a/gas/config/tc-arc.c +++ b/gas/config/tc-arc.c @@ -2562,7 +2562,7 @@ declare_register_set (void) int i; for (i = 0; i < 64; ++i) { - char name[7]; + char name[32]; sprintf (name, "r%d", i); declare_register (name, i); diff --git a/gas/config/tc-epiphany.c b/gas/config/tc-epiphany.c index 836b23b..552f7da 100644 --- a/gas/config/tc-epiphany.c +++ b/gas/config/tc-epiphany.c @@ -550,7 +550,7 @@ md_assemble (char *str) if (push && regmask) { - char buff[20]; + char buff[32]; int i,p ATTRIBUTE_UNUSED; epiphany_assemble ("mov r15,4"); @@ -570,7 +570,7 @@ md_assemble (char *str) } else if (pop && regmask) { - char buff[20]; + char buff[32]; int i,p; epiphany_assemble ("mov r15,4"); diff --git a/gas/config/tc-mips.c b/gas/config/tc-mips.c index b178682..00e9ece 100644 --- a/gas/config/tc-mips.c +++ b/gas/config/tc-mips.c @@ -3806,7 +3806,7 @@ md_begin (void) for (i = 0; i < 32; i++) { - char regname[6]; + char regname[16]; /* R5900 VU0 floating-point register. */ sprintf (regname, "$vf%d", i); diff --git a/gas/config/tc-mmix.c b/gas/config/tc-mmix.c index c469a62..82a9f83 100644 --- a/gas/config/tc-mmix.c +++ b/gas/config/tc-mmix.c @@ -780,7 +780,7 @@ mmix_md_begin (void) /* We always insert the ordinary registers 0..255 as registers. */ for (i = 0; i < 256; i++) { - char buf[5]; + char buf[16]; /* Alternatively, we could diddle with '$' and the following number, but keeping the registers as symbols helps keep parsing simple. */ diff --git a/gas/config/tc-nds32.c b/gas/config/tc-nds32.c index 62bbad7..b23f326 100644 --- a/gas/config/tc-nds32.c +++ b/gas/config/tc-nds32.c @@ -6053,6 +6053,7 @@ nds32_elf_append_relax_relocs (const char *key, const void *value) fixup_size = fixup_now->size; /* Insert all fixup. */ + pcrel = 0; while (fixup_size != 0 && fixup_now->offset == offset) { /* Set the real instruction size in element. */ |