[PATCH] remove pointless assignment
Alan Modra
amodra@gmail.com
Thu Apr 14 22:23:00 GMT 2016
More information about the Binutils mailing list
Thu Apr 14 22:23:00 GMT 2016
- Previous message (by thread): [PATCH] remove pointless assignment
- Next message (by thread): [PATCH] remove pointless assignment
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Thu, Apr 14, 2016 at 05:36:55PM -0400, tbsaunde+binutils@tbsaunde.org wrote: > 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)); OK. Interestingly, gcc only warns about this with -pedantic. warning: invalid application of ‘sizeof’ to a function type [-Wpointer-arith] Hmm, there's really no need for snprintf here. We know exactly how large the result string will be, so if you like, you can replace snprintf with sprintf while you're editing this code. Oh, and use char regname[6]. An odd size (not a power of two or multiple of 10) says to me the programmer has calculated maximum needed size, so we may as well use the correct max size. -- Alan Modra Australia Development Lab, IBM
- Previous message (by thread): [PATCH] remove pointless assignment
- Next message (by thread): [PATCH] remove pointless assignment
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Binutils mailing list