https://gcc.gnu.org/g:b8ecd96aea9a97a60b143fc70efa6d03d0f188a2
commit r15-5163-gb8ecd96aea9a97a60b143fc70efa6d03d0f188a2 Author: Jeff Law <j...@ventanamicro.com> Date: Tue Nov 12 06:15:50 2024 -0700 [committed] Fix minor c6x backend bug exposed by CRC patches This is a minor bug in the c6x port I saw when testing Mariam's CRC work. Specifically some of the CRC tests were failing with a segfault testing if an operand was an "a_register" from within the dest_regfile attribute. We were extracting what we thought should have been a register operand then looking at the REGNO. The underlying data was totally bogus, hence the fault in the accessor macros. The core issue is we were trying to extract operands from a nop insn which has no operands. As far as I can tell "unknown" is a reasonable answer for the dest_regfile attribute on a nop insn, so this patch adds an explicit setting of dest_regfile rather than letting the default processing kick in. I'm applying the attached patch to the trunk. There's still a backend bug affecting ~15 CRC tests. Essentially the assembler complains about a label (related to debugging info) not at the start of an execution packet. I'm not chasing this down. gcc/ * config/c6x/c6x.md (nop, nop_count): Add explicit "dest_regfile" attribute setting. Diff: --- gcc/config/c6x/c6x.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/gcc/config/c6x/c6x.md b/gcc/config/c6x/c6x.md index ea9ffe8b4e10..9e0aa61947eb 100644 --- a/gcc/config/c6x/c6x.md +++ b/gcc/config/c6x/c6x.md @@ -365,12 +365,14 @@ (define_insn "nop" [(const_int 0)] "" - "nop") + "nop" + [(set_attr "dest_regfile" "unknown")]) (define_insn "nop_count" [(unspec [(match_operand 0 "const_int_operand" "n")] UNSPEC_NOP)] "" - "%|%.\\tnop\\t%0") + "%|%.\\tnop\\t%0" + [(set_attr "dest_regfile" "unknown")]) ;; ------------------------------------------------------------------------- ;; Move instructions