aboutsummaryrefslogtreecommitdiff
path: root/gas/config/tc-mips.c
diff options
context:
space:
mode:
authorTrevor Saunders <tbsaunde+binutils@tbsaunde.org>2016-04-13 05:03:22 -0400
committerTrevor Saunders <tbsaunde+binutils@tbsaunde.org>2016-04-15 21:20:36 -0400
commit92fce9bd7a4d5732fe9db05b7ebaef4ab858e69a (patch)
treee2a7df2797a2024e5486a72abb2dfc66899a4e50 /gas/config/tc-mips.c
parent58484447ed8e1c64bbd73f224c8c9452a7420beb (diff)
downloadgdb-92fce9bd7a4d5732fe9db05b7ebaef4ab858e69a.zip
gdb-92fce9bd7a4d5732fe9db05b7ebaef4ab858e69a.tar.gz
gdb-92fce9bd7a4d5732fe9db05b7ebaef4ab858e69a.tar.bz2
remove pointless assignment
Presumably this was supposed to be regname[sizeof (regname) - 1] but was typoed to regname[sizeof (rename) - 1]. However that should be unnecessary because sprintf should null terminate. As is this assignment is invalid ISO C because rename refers to the function rename (), and sizeof on functions is undefined. In GNU C C the size of functions is 1 so the expression is the same as regname[0]. The following call to sprintf () clearly will over right that, so the statement either has no effect or is invalid. Given that it seems safe to just remove it. While we are there correct the size of regname, and switch from snprintf to sprintf since we know the exact length of the result. gas/ChangeLog: 2016-04-15 Trevor Saunders <tbsaunde+binutils@tbsaunde.org> * config/tc-mips.c (md_begin): Remove useless assignment.
Diffstat (limited to 'gas/config/tc-mips.c')
-rw-r--r--gas/config/tc-mips.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/gas/config/tc-mips.c b/gas/config/tc-mips.c
index 118b91d..bfc639e 100644
--- a/gas/config/tc-mips.c
+++ b/gas/config/tc-mips.c
@@ -3601,21 +3601,20 @@ md_begin (void)
for (i = 0; i < 32; i++)
{
- char regname[7];
+ char regname[6];
/* R5900 VU0 floating-point register. */
- regname[sizeof (rename) - 1] = 0;
- snprintf (regname, sizeof (regname) - 1, "$vf%d", i);
+ sprintf (regname, "$vf%d", i);
symbol_table_insert (symbol_new (regname, reg_section,
RTYPE_VF | i, &zero_address_frag));
/* R5900 VU0 integer register. */
- snprintf (regname, sizeof (regname) - 1, "$vi%d", i);
+ sprintf (regname, "$vi%d", i);
symbol_table_insert (symbol_new (regname, reg_section,
RTYPE_VI | i, &zero_address_frag));
/* MSA register. */
- snprintf (regname, sizeof (regname) - 1, "$w%d", i);
+ sprintf (regname, "$w%d", i);
symbol_table_insert (symbol_new (regname, reg_section,
RTYPE_MSA | i, &zero_address_frag));
}