This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
[PATCH] remove pointless assignment
- From: tbsaunde+binutils at tbsaunde dot org
- To: binutils at sourceware dot org
- Cc: Trevor Saunders <tbsaunde+binutils at tbsaunde dot org>
- Date: Thu, 14 Apr 2016 17:36:55 -0400
- Subject: [PATCH] remove pointless assignment
- Authentication-results: sourceware.org; auth=none
From: Trevor Saunders <tbsaunde+binutils@tbsaunde.org>
Hi,
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.
built and regtested cross to mips64-elf, ok?
Trev
gas/ChangeLog:
2016-04-14 Trevor Saunders <tbsaunde+binutils@tbsaunde.org>
* config/tc-mips.c (md_begin): Remove useless assignment.
---
gas/config/tc-mips.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/gas/config/tc-mips.c b/gas/config/tc-mips.c
index 118b91d..f3dbd5f 100644
--- a/gas/config/tc-mips.c
+++ b/gas/config/tc-mips.c
@@ -3604,7 +3604,6 @@ md_begin (void)
char regname[7];
/* R5900 VU0 floating-point register. */
- regname[sizeof (rename) - 1] = 0;
snprintf (regname, sizeof (regname) - 1, "$vf%d", i);
symbol_table_insert (symbol_new (regname, reg_section,
RTYPE_VF | i, &zero_address_frag));
--
2.1.4