/export/gnu/import/git/sources/binutils-gdb/gas/config/tc-score.c:4575:6: error: ‘sprintf’ argument 3 may overlap destination object ‘keep_data’ [-Werror=restrict] 4575 | sprintf (append_str, "bne %s", keep_data); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /export/gnu/import/git/sources/binutils-gdb/gas/config/tc-score.c:4573:6: error: ‘sprintf’ argument 3 may overlap destination object ‘keep_data’ [-Werror=restrict] 4573 | sprintf (append_str, "beq %s", keep_data); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /export/gnu/import/git/sources/binutils-gdb/gas/config/tc-score.c:4542:3: error: ‘sprintf’ argument 3 may overlap destination object ‘keep_data’ [-Werror=restrict] 4542 | sprintf (append_str, "bne %s", keep_data); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /export/gnu/import/git/sources/binutils-gdb/gas/config/tc-score.c:4540:3: error: ‘sprintf’ argument 3 may overlap destination object ‘keep_data’ [-Werror=restrict] 4540 | sprintf (append_str, "beq %s", keep_data); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /export/gnu/import/git/sources/binutils-gdb/gas/config/tc-score.c: In function ‘s3_do_macro_bcmpz’: /export/gnu/import/git/sources/binutils-gdb/gas/config/tc-score.c:4722:6: error: ‘sprintf’ argument 3 may overlap destination object ‘keep_data’ [-Werror=restrict] 4722 | sprintf (append_str, "bne %s", keep_data); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /export/gnu/import/git/sources/binutils-gdb/gas/config/tc-score.c:4720:6: error: ‘sprintf’ argument 3 may overlap destination object ‘keep_data’ [-Werror=restrict] 4720 | sprintf (append_str, "beq %s", keep_data); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /export/gnu/import/git/sources/binutils-gdb/gas/config/tc-score.c:4690:3: error: ‘sprintf’ argument 3 may overlap destination object ‘keep_data’ [-Werror=restrict] 4690 | sprintf (append_str, "bne %s", keep_data); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /export/gnu/import/git/sources/binutils-gdb/gas/config/tc-score.c:4688:3: error: ‘sprintf’ argument 3 may overlap destination object ‘keep_data’ [-Werror=restrict] 4688 | sprintf (append_str, "beq %s", keep_data); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ cc1: all warnings being treated as errors make[7]: *** [Makefile:1229: config/tc-score.o] Error 1 tc-score.c has char *append_str = keep_data + keep_data_size; ... if ((inst_main.instruction & 0x3e00007e) == 0x0000004c) sprintf (append_str, "beq %s", keep_data); else sprintf (append_str, "bne %s", keep_data);
The master branch has been updated by H.J. Lu <hjl@sourceware.org>: https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=a05e3e203954fac0aacfcb647b1f8b52760e6df0 commit a05e3e203954fac0aacfcb647b1f8b52760e6df0 Author: H.J. Lu <hjl.tools@gmail.com> Date: Tue May 26 06:09:54 2020 -0700 tc-score.c: Replace overlapping sprintf with memmove Fix GCC 10 warning: gas/config/tc-score.c:4575:6: error: âsprintfâ argument 3 may overlap destination object âkeep_dataâ [-Werror=restrict] 4575 | sprintf (append_str, "bne %s", keep_data); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ PR gas/26044 * onfig/tc-score.c (s3_do_macro_bcmp): Replace overlapping sprintf with memmove.
gas/config/tc-crx.c:434:17: error: writing 1 byte into a region of size 0 [-Werror=stringop-overflow=] 434 | *++opcode = 0x31; | ~~~~~~~~~~^~~~~~
gas/config/tc-crx.c:1269:38: error: implicit conversion from ‘copreg’ to ‘reg’ [-Werror=enum-conversion] 1269 | CRX_PRINT (0, getreg_image (arg->cr), shift);
gas/config/tc-crx.c:50:63: note: in definition of macro ‘CRX_PRINT’ 50 | #define CRX_PRINT(BYTE, NUM, SHIFT) output_opcode[BYTE] |= (NUM << SHIFT) |
gas/config/tc-v850.c:1750:17: error: writing 1 byte into a region of size 0 [-Werror=stringop-overflow=] 1750 | buffer[1] = 0x07; | ~~~~~~~~~~^~~~~~
The master branch has been updated by H.J. Lu <hjl@sourceware.org>: https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=e67e940f5d9102fb452b87aca441a2829a67d66b commit e67e940f5d9102fb452b87aca441a2829a67d66b Author: H.J. Lu <hjl.tools@gmail.com> Date: Tue May 26 06:46:26 2020 -0700 gas: Silence GCC 10 warning on tc-crx.c opcode/crx.h has typedef enum { ... MAX_REG } reg; typedef enum { c0 = MAX_REG, } copreg; tc-crx.c has static int getreg_image (reg r) { ... /* Check whether the register is in registers table. */ if (r < MAX_REG) rreg = &crx_regtab[r]; /* Check whether the register is in coprocessor registers table. */ else if (r < (int) MAX_COPREG) rreg = &crx_copregtab[r-MAX_REG]; } Change getreg_image's argument type to int and replace fragP->fr_literal with &fragP->fr_literal[0] to silence GCC 10 warning. PR gas/26044 * config/tc-crx.c (getreg_image): Change argument type to int. (md_convert_frag): Replace fragP->fr_literal with &fragP->fr_literal[0].
The master branch has been updated by H.J. Lu <hjl@sourceware.org>: https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=70b1b570bfba0c97b37870747eb4bc0ae665cf66 commit 70b1b570bfba0c97b37870747eb4bc0ae665cf66 Author: H.J. Lu <hjl.tools@gmail.com> Date: Tue May 26 06:56:18 2020 -0700 gas: Silence GCC 10 warning on tc-v850.c PR gas/26044 * config/tc-v850.c (md_convert_frag): Replace fragP->fr_literal with &fragP->fr_literal[0].
gas/config/tc-vax.c:452:13: error: writing 1 byte into a region of size 0 [-Werror=stringop-overflow=] 452 | p[1] = VAX_BRB;
The master branch has been updated by H.J. Lu <hjl@sourceware.org>: https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=c4612b92e38e9495970afc703f222f99d27c1b4d commit c4612b92e38e9495970afc703f222f99d27c1b4d Author: H.J. Lu <hjl.tools@gmail.com> Date: Tue May 26 07:41:07 2020 -0700 gas: Silence GCC 10 warning tc-vax.c PR gas/26044 * config/tc-vax.c (md_estimate_size_before_relax): Replace fragP->fr_literal with &fragP->fr_literal[0]. (md_convert_frag): Likewise.
gas/config/tc-visium.c:497:7: error: writing 4 bytes into a region of size 0 [-Werror=stringop-overflow=] 497 | memcpy (buf + 4, buf, 4); | ^~~~~~~~~~~~~~~~~~~~~~~~
The master branch has been updated by H.J. Lu <hjl@sourceware.org>: https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=8bbc5da5ee827bd9c962d238777e20db2c100598 commit 8bbc5da5ee827bd9c962d238777e20db2c100598 Author: H.J. Lu <hjl.tools@gmail.com> Date: Tue May 26 07:54:05 2020 -0700 gas: Silence GCC 10 warning on tc-visium.c PR gas/26044 * config/tc-visium.c (md_convert_frag): Replace fragP->fr_literal with &fragP->fr_literal[0].
gas/config/tc-xgate.c:1339:5: error: implicit conversion from ‘enum elf_xgate_reloc_type’ to ‘bfd_reloc_code_real_type’ {aka ‘enum bfd_reloc_code_real’} [-Werror=enum-conversion] 1339 | R_XGATE_PCREL_9); | ^~~~~~~~~~~~~~~
The master branch has been updated by H.J. Lu <hjl@sourceware.org>: https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=e3fed0f2fe98c52dc8cb160be2a30e973b1dca3f commit e3fed0f2fe98c52dc8cb160be2a30e973b1dca3f Author: H.J. Lu <hjl.tools@gmail.com> Date: Tue May 26 09:33:48 2020 -0700 tc-xgate.c: Replace R_XGATE_PCREL_X with BFD_RELOC_XGATE_PCREL_X Replace R_XGATE_PCREL_X with BFD_RELOC_XGATE_PCREL_X to silence GCC 10 warning: gas/config/tc-xgate.c:1339:5: error: implicit conversion from âenum elf_xgate_reloc_typeâ to âbfd_reloc_code_real_typeâ {aka âenum bfd_reloc_code_realâ} [-Werror=enum-conversion] 1339 | R_XGATE_PCREL_9); | ^~~~~~~~~~~~~~~ PR gas/26044 * config/tc-xgate.c (md_apply_fix): Check BFD_RELOC_XGATE_PCREL_X instead of R_XGATE_PCREL_X. (xgate_parse_operand): Replace R_XGATE_PCREL_X with BFD_RELOC_XGATE_PCREL_X.
All of the "Replace fragP->fr_literal with &fragP->fr_literal[0]" patches are just silencing a gcc bug. Have you opened a gcc bug? (Some future version of gcc might see through the obfuscation of the source, rendering your work-around ineffective.)
BTW, that last comment wasn't meant to indicate I disagree with the patches to work around these warnings. I'm happy with the binutils patches.
(In reply to Alan Modra from comment #14) > All of the "Replace fragP->fr_literal with &fragP->fr_literal[0]" patches > are just silencing a gcc bug. Have you opened a gcc bug? (Some future > version of gcc might see through the obfuscation of the source, rendering > your work-around ineffective.) https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95353
Also commit a39d29cda15d4f303c989eb0ac644a3144827881 Author: H.J. Lu <hjl.tools@gmail.com> Date: Mon May 25 04:50:56 2020 -0700 gas: Update fr_literal access in frag for GCC 10 commit 6c115e16cadbca943396df6078b1c596fec49b73 Author: H.J. Lu <hjl.tools@gmail.com> Date: Mon May 25 16:17:50 2020 -0700 gas: Silence GCC 10 warning on tc-cr16.c commit c6412eeea9de28f1a7c69c1ea2dc5d736642648f Author: H.J. Lu <hjl.tools@gmail.com> Date: Mon May 25 19:37:54 2020 -0700 gas: Silence GCC 10 warning on tc-mcore.c are needed for this bug.
The master branch has been updated by Alan Modra <amodra@sourceware.org>: https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=8eff95bcb6a778c35b91e61ccc066db335d7f06b commit 8eff95bcb6a778c35b91e61ccc066db335d7f06b Author: Alan Modra <amodra@gmail.com> Date: Thu May 28 18:46:17 2020 +0930 PR26044, Some targets can't be compiled with GCC 10 (tilepro) Since this value is used in fields of type tilepro_pipeline (as NO_PIPELINE, see tc-tilepro.c) it is appropriate to put it in the tilepro_pipelen enum. This avoids a warning about converting from one enum type to another. PR 26044 * opcode/tilepro.h (TILEPRO_NUM_PIPELINE_ENCODINGS): Move to tilepro_pipeline enum.
Current master compiles fine using gcc-10
Should be fixed for 2.35.