diff options
author | H.J. Lu <hjl.tools@gmail.com> | 2020-05-25 04:50:56 -0700 |
---|---|---|
committer | H.J. Lu <hjl.tools@gmail.com> | 2020-05-25 04:51:17 -0700 |
commit | a39d29cda15d4f303c989eb0ac644a3144827881 (patch) | |
tree | c69bea759e1899279bcde7de86df7bec2f07d95c /gas/config/tc-csky.c | |
parent | 8f7d38efadee2a4f75fb2085e02dab658aa37f38 (diff) | |
download | binutils-gdb-a39d29cda15d4f303c989eb0ac644a3144827881.tar.gz |
gas: Update fr_literal access in frag for GCC 10
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.
Diffstat (limited to 'gas/config/tc-csky.c')
-rw-r--r-- | gas/config/tc-csky.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/gas/config/tc-csky.c b/gas/config/tc-csky.c index 83fca2af73d..be54afbd679 100644 --- a/gas/config/tc-csky.c +++ b/gas/config/tc-csky.c @@ -4196,7 +4196,7 @@ void 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)) |