From a39d29cda15d4f303c989eb0ac644a3144827881 Mon Sep 17 00:00:00 2001 From: "H.J. Lu" Date: Mon, 25 May 2020 04:50:56 -0700 Subject: gas: Update fr_literal access in frag for GCC 10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- gas/config/tc-sh.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'gas/config/tc-sh.c') diff --git a/gas/config/tc-sh.c b/gas/config/tc-sh.c index d06cc5e..42f7417 100644 --- a/gas/config/tc-sh.c +++ b/gas/config/tc-sh.c @@ -3081,7 +3081,7 @@ md_convert_frag (bfd *headers ATTRIBUTE_UNUSED, segT seg, fragS *fragP) 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); -- cgit v1.1