When access fr_literal in
struct frag {
...
/* Data begins here. */
char fr_literal[1];
};
with
char *buf = fragp->fr_fix + fragp->fr_literal;
GCC 10 gave
gas/config/tc-csky.c: In function ‘md_convert_frag’:
gas/config/tc-csky.c:4507:9: error: writing 1 byte into a region of size 0 [-Werror=stringop-overflow=]
4507 | buf[1] = BYTE_1 (CSKYV1_INST_SUBI | (7 << 4));
| ^
Change
char *buf = fragp->fr_fix + fragp->fr_literal;
to
char *buf = fragp->fr_fix + &fragp->fr_literal[0];
to silence GCC 10 warning.
* config/tc-csky.c (md_convert_frag): Replace fragp->fr_literal
with &fragp->fr_literal[0].
* config/tc-microblaze.c (md_apply_fix): Likewise.
* config/tc-sh.c (md_convert_frag): Likewise.
+2020-05-25 H.J. Lu <hongjiu.lu@intel.com>
+
+ * config/tc-csky.c (md_convert_frag): Replace fragp->fr_literal
+ with &fragp->fr_literal[0].
+ * config/tc-microblaze.c (md_apply_fix): Likewise.
+ * config/tc-sh.c (md_convert_frag): Likewise.
+
2020-05-24 Jim Wilson <jimw@sifive.com>
PR 26025
md_convert_frag (bfd *abfd ATTRIBUTE_UNUSED, segT asec, fragS *fragp)
{
offsetT disp;
- char *buf = fragp->fr_fix + fragp->fr_literal;
+ char *buf = fragp->fr_fix + &fragp->fr_literal[0];
gas_assert (fragp->fr_symbol);
if (IS_EXTERNAL_SYM (fragp->fr_symbol, asec))
valueT * valp,
segT segment)
{
- char * buf = fixP->fx_where + fixP->fx_frag->fr_literal;
+ char * buf = fixP->fx_where + &fixP->fx_frag->fr_literal[0];
const char * file = fixP->fx_file ? fixP->fx_file : _("unknown");
const char * symname;
/* Note: use offsetT because it is signed, valueT is unsigned. */
differently from ones without delay slots. */
{
unsigned char *buffer =
- (unsigned char *) (fragP->fr_fix + fragP->fr_literal);
+ (unsigned char *) (fragP->fr_fix + &fragP->fr_literal[0]);
int highbyte = target_big_endian ? 0 : 1;
int lowbyte = target_big_endian ? 1 : 0;
int delay = fragP->fr_subtype == C (COND_JUMP_DELAY, COND12);