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.

Jeff

        * config/c6x/c6x.md (nop, nop_count): Add explicit
        "dest_regfile" attribute setting.

diff --git a/gcc/config/c6x/c6x.md b/gcc/config/c6x/c6x.md
index ea9ffe8b4e1..9e0aa61947e 100644
--- a/gcc/config/c6x/c6x.md
+++ b/gcc/config/c6x/c6x.md
@@ -365,12 +365,14 @@ (define_cond_exec
 (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

Reply via email to