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

            Bug ID: 119362
           Summary: tree-object-size.cc:1377:1: error: unrecognizable insn
           Product: gcc
           Version: 15.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: rtl-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: danglin at gcc dot gnu.org
                CC: vmakarov at gcc dot gnu.org
  Target Milestone: ---
              Host: hppa*-*-linux*
            Target: hppa*-*-linux*
             Build: hppa*-*-linux*

Created attachment 60814
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=60814&action=edit
Preprocessed source.

The following error occurs in stage 2 LRA enabled:

/home/dave/gnu/gcc/objdir/./prev-gcc/xg++
-B/home/dave/gnu/gcc/objdir/./prev-gcc/
-B/home/dave/opt/gnu/gcc/gcc-15/hppa-linux-gnu/bin/ -nostdinc++
-B/home/dave/gnu/gcc/objdir/prev-hppa-linux-gnu/libstdc++-v3/src/.libs
-B/home/dave/gnu/gcc/objdir/prev-hppa-linux-gnu/libstdc++-v3/libsupc++/.libs 
-I/home/dave/gnu/gcc/objdir/prev-hppa-linux-gnu/libstdc++-v3/include/hppa-linux-gnu
 -I/home/dave/gnu/gcc/objdir/prev-hppa-linux-gnu/libstdc++-v3/include 
-I/home/dave/gnu/gcc/gcc/libstdc++-v3/libsupc++
-L/home/dave/gnu/gcc/objdir/prev-hppa-linux-gnu/libstdc++-v3/src/.libs
-L/home/dave/gnu/gcc/objdir/prev-hppa-linux-gnu/libstdc++-v3/libsupc++/.libs 
-fno-PIE -c   -g -O2 -fno-checking -DIN_GCC    -fno-exceptions -fno-rtti
-fasynchronous-unwind-tables -W -Wall -Wno-error=narrowing -Wwrite-strings
-Wcast-qual -Wmissing-format-attribute -Wconditionally-supported
-Woverloaded-virtual -pedantic -Wno-long-long -Wno-variadic-macros
-Wno-overlength-strings -Werror  -DHAVE_CONFIG_H -fno-PIE -I. -I.
-I../../gcc/gcc -I../../gcc/gcc/. -I../../gcc/gcc/../include 
-I../../gcc/gcc/../libcpp/include -I../../gcc/gcc/../libcody 
-I../../gcc/gcc/../libdecnumber -I../../gcc/gcc/../libdecnumber/dpd
-I../libdecnumber -I../../gcc/gcc/../libbacktrace   -o tree-object-size.o -MT
tree-object-size.o -MMD -MP -MF ./.deps/tree-object-size.TPo
../../gcc/gcc/tree-object-size.cc
../../gcc/gcc/tree-object-size.cc: In function ‘bool
compute_builtin_object_size(tree, int, tree_node**)’:
../../gcc/gcc/tree-object-size.cc:1377:1: error: unrecognizable insn:
 1377 | }
      | ^
(insn 4783 0 0 (set (reg:SI 1499)
        (mem/c:SI (plus:SI (reg/f:SI 89 sfp)
                (const_int -248 [0xffffffffffffff08])) [20 MEM[(int *)&osi]+0
S4 A64])) -1
     (nil))
during RTL pass: reload
../../gcc/gcc/tree-object-size.cc:1377:1: internal compiler error: in
extract_insn, at recog.cc:2882
0x17adf6b internal_error(char const*, ...)
        ../../gcc/gcc/diagnostic-global-context.cc:517
0x179bd1f fancy_abort(char const*, int, char const*)
        ../../gcc/gcc/diagnostic.cc:1722
0xabed03 _fatal_insn(char const*, rtx_def const*, char const*, int, char
const*)
        ../../gcc/gcc/rtl-error.cc:108
0xabed33 _fatal_insn_not_found(rtx_def const*, char const*, int, char const*)
        ../../gcc/gcc/rtl-error.cc:116
0xa82253 extract_insn(rtx_insn*)
        ../../gcc/gcc/recog.cc:2882
0x8e7923 ira_remove_insn_scratches(rtx_insn*, bool, _IO_FILE*, rtx_def*
(*)(rtx_def*))
        ../../gcc/gcc/ira.cc:5370
0x92dc7b remove_insn_scratches
        ../../gcc/gcc/lra.cc:2161
0x92fb0b lra_emit_move(rtx_def*, rtx_def*)
        ../../gcc/gcc/lra.cc:513
0x93e39b process_addr_reg
        ../../gcc/gcc/lra-constraints.cc:1611
0x93f6fb process_address_1
        ../../gcc/gcc/lra-constraints.cc:3814
0x9445eb process_address
        ../../gcc/gcc/lra-constraints.cc:4053
0x9445eb curr_insn_transform
        ../../gcc/gcc/lra-constraints.cc:4298
0x947ed7 lra_constraints(bool)
        ../../gcc/gcc/lra-constraints.cc:5569
0x932bbf lra(_IO_FILE*, int)
        ../../gcc/gcc/lra.cc:2449
0x8e2d3f do_reload
        ../../gcc/gcc/ira.cc:5987
0x8e2d3f execute
        ../../gcc/gcc/ira.cc:6175
Please submit a full bug report, with preprocessed source (by using
-freport-bug).
Please include the complete backtrace with any bug report.

LRA was enabled with following change:
diff --git a/gcc/config/pa/pa.opt b/gcc/config/pa/pa.opt
index fae4247d50d..e90c4cacbd5 100644
--- a/gcc/config/pa/pa.opt
+++ b/gcc/config/pa/pa.opt
@@ -87,7 +87,7 @@ Target Mask(LONG_CALLS)
 Always generate long calls.

 mlra
-Target Var(pa_lra_p) Init(0)
+Target Var(pa_lra_p) Init(1)
 Use LRA instead of reload (transitional).

 mlong-load-store

I believe this bug was introduced by the following commit:

commit e355fe414aa3aaf215c7dd9dd789ce217a1b458c (HEAD)
Author: Vladimir N. Makarov <vmaka...@redhat.com>
Date:   Mon Mar 10 16:26:59 2025 -0400

    [PR114991][IRA]: Improve reg equiv invariant calculation

    In PR test case IRA preferred to allocate hard reg to a pseudo instead
    of its equivalence.  This resulted in allocating caller-saved hard reg
    and generating save/restore insns in the function prologue/epilogue.
    The equivalence is an invariant (stack pointer plus offset) and the
    pseudo is used mostly as memory address.  This happened as there was
    no simplification of insn after the invariant substitution.  The patch
    adds the necessary code.

    gcc/ChangeLog:

            PR target/114991
            * ira-costs.cc (equiv_can_be_consumed_p): Add new argument
invariant_p.
            Add code for dealing with the invariant.
            (calculate_equiv_gains): Don't consider init insns.  Pass the new
            argument to equiv_can_be_consumed_p.  Don't treat invariant as
            memory.

    gcc/testsuite/ChangeLog:

            PR target/114991
            * gcc.target/aarch64/pr114991.c: New test.

The soft frame pointer (sfp) didn't get a hard register.

Reply via email to