https://gcc.gnu.org/bugzilla/show_bug.cgi?id=125497

            Bug ID: 125497
           Summary: print_rtx_function output not recognized by read-rtl
           Product: gcc
           Version: 17.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: middle-end
          Assignee: unassigned at gcc dot gnu.org
          Reporter: gjl at gcc dot gnu.org
  Target Milestone: ---

Created attachment 64576
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=64576&action=edit
C+RTL test case

So I have this C function in void.c

void func (void)
{
}

which print_rtx_function(stderr, f, true) prints like (embedding C func added
by me):

void __RTL (startwith ("ira")) func (void)
{
(function "func"
  (insn-chain
    (cnote 1 NOTE_INSN_DELETED)
    (block 2
      (edge-from entry (flags "FALLTHRU"))
      (cnote 3 [bb 2] NOTE_INSN_BASIC_BLOCK)
      (cnote 2 NOTE_INSN_FUNCTION_BEG)
      (edge-to exit (flags "FALLTHRU"))
    ) ;; block 2
  ) ;; insn-chain
  (crtl
    (return_rtx 
      (nil)
    ) ;; return_rtx
  ) ;; crtl
) ;; function "func"
}

When I feed that into the compiler, it doesn't recognize the "nil" after
return_rtx:

$ avr-gcc void-rtl.c -S -Os
void-rtl.c:15:10: error: unknown rtx code `nil'
void-rtl.c:15:11: note: following context is `)'

This is the patchlet that I used to print the RTL:

diff --git a/gcc/ira.cc b/gcc/ira.cc
index 85c7ec419b3..a823a4ba60e 100644
--- a/gcc/ira.cc
+++ b/gcc/ira.cc
@@ -6214,8 +6214,10 @@ public:
     {
       return !targetm.no_register_allocation;
     }
-  unsigned int execute (function *) final override
+  unsigned int execute (function *f) final override
     {
+      if (avropt_log_details)
+       print_rtx_function (stderr, f, true);
       ira_in_progress = true;
       ira (dump_file);
       ira_in_progress = false;

$ avr-gcc void.c -S -Os -mlog=x
(function "func"
  (insn-chain
    (cnote 1 NOTE_INSN_DELETED)
    (block 2
      (edge-from entry (flags "FALLTHRU"))
      (cnote 3 [bb 2] NOTE_INSN_BASIC_BLOCK)
      (cnote 2 NOTE_INSN_FUNCTION_BEG)
      (edge-to exit (flags "FALLTHRU"))
    ) ;; block 2
  ) ;; insn-chain
  (crtl
    (return_rtx 
      (nil)
    ) ;; return_rtx
  ) ;; crtl
) ;; function "func"

Target: avr
Configured with: ../../source/gcc-master/configure --target=avr --disable-nls
--with-dwarf2 --with-gnu-as --with-gnu-ld --with-long-double=64
--disable-libcc1 --enable-languages=c,c++
Thread model: single
Supported LTO compression algorithms: zlib
gcc version 17.0.0 20260528 (experimental) (GCC)

Reply via email to