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

            Bug ID: 118778
           Summary: ICE: SIGSEGV in print_type (c-objc-common.cc:239) OR
                    unrecognizable insn: (set (reg:SF ...) (mem/c:SF ...))
                    with -mgeneral-regs-only and "float"
           Product: gcc
           Version: 15.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: zsojka at seznam dot cz
  Target Milestone: ---
              Host: x86_64-pc-linux-gnu
            Target: armv7a-hardfloat-linux-gnueabi

Created attachment 60408
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=60408&action=edit
reduced testcase

Compiler output:
$ armv7a-hardfloat-linux-gnueabi-gcc -mgeneral-regs-only testcase.i -wrapper
valgrind,-q
==32066== Invalid read of size 2
==32066==    at 0xB690D4: print_type(c_pretty_printer*, tree_node*, bool*, char
const*) (c-objc-common.cc:239)
==32066==    by 0xB69501: c_tree_printer(pretty_printer*, text_info*, char
const*, int, bool, bool, bool, bool*, pp_token_list&) (c-objc-common.cc:363)
==32066==    by 0x23B7C06: format_phase_2 (pretty-print.cc:2158)
==32066==    by 0x23B7C06: pretty_printer::format(text_info&)
(pretty-print.cc:1711)
==32066==    by 0x237FB9D: pp_format (pretty-print.h:594)
==32066==    by 0x237FB9D:
diagnostic_context::report_diagnostic(diagnostic_info*) (diagnostic.cc:1478)
==32066==    by 0x237FEED: diagnostic_context::diagnostic_impl(rich_location*,
diagnostic_metadata const*, diagnostic_option_id, char const*, __va_list_tag
(*) [1], diagnostic_t) (diagnostic.cc:1614)
==32066==    by 0x2394B21: error(char const*, ...)
(diagnostic-global-context.cc:397)
==32066==    by 0x16C3B61: aapcs_vfp_is_call_or_return_candidate(arm_pcs,
machine_mode, tree_node const*, machine_mode*, int*) (arm.cc:6724)
==32066==    by 0x16B4277: aapcs_select_call_coproc (arm.cc:6932)
==32066==    by 0x16B4277: aapcs_layout_arg(CUMULATIVE_ARGS*, machine_mode,
tree_node const*, bool) [clone .part.0] [clone .constprop.0] (arm.cc:7062)
==32066==    by 0x16B9975: aapcs_layout_arg (arm.cc:7056)
==32066==    by 0x16B9975: arm_function_arg(cumulative_args_t,
function_arg_info const&) (arm.cc:7304)
==32066==    by 0xCA1C82: emit_library_call_value_1(int, rtx_def*, rtx_def*,
libcall_type, machine_mode, int, std::pair<rtx_def*, machine_mode>*)
(calls.cc:4407)
==32066==    by 0x10E69CC: emit_library_call_value (rtl.h:4439)
==32066==    by 0x10E69CC: prepare_float_lib_cmp (optabs.cc:4955)
==32066==    by 0x10E69CC: prepare_cmp_insn(rtx_def*, rtx_def*, rtx_code,
rtx_def*, int, optab_methods, rtx_def**, machine_mode*) (optabs.cc:4588)
==32066==    by 0x10E71C2: emit_cmp_and_jump_insns(rtx_def*, rtx_def*,
rtx_code, rtx_def*, machine_mode, int, tree_node*, rtx_def*,
profile_probability) (optabs.cc:4812)
==32066==  Address 0x0 is not stack'd, malloc'd or (recently) free'd
==32066== 

during RTL pass: expand
In function 'foo':
Segmentation fault
    2 | int foo() { return f < 0; }
      |                    ~~^~~
0x2395361 internal_error(char const*, ...)
        /repo/gcc-trunk/gcc/diagnostic-global-context.cc:517
..

Or, when foo() is commented-out:
$ armv7a-hardfloat-linux-gnueabi-gcc -mgeneral-regs-only testcase.i
testcase.i: In function 'bar':
testcase.i:3:21: error: unrecognizable insn:
    3 | void bar() { f < 0; }
      |                     ^
(insn 6 5 0 2 (set (reg:SF 114 [ f.0_1 ])
        (mem/c:SF (reg/f:SI 115) [1 f+0 S4 A32])) "testcase.i":3:16 -1
     (nil))
during RTL pass: vregs
testcase.i:3:21: internal compiler error: in extract_insn, at recog.cc:2882
0x2395361 internal_error(char const*, ...)
        /repo/gcc-trunk/gcc/diagnostic-global-context.cc:517
0xaf9d37 fancy_abort(char const*, int, char const*)
        /repo/gcc-trunk/gcc/diagnostic.cc:1722
0x7cdc56 _fatal_insn(char const*, rtx_def const*, char const*, int, char
const*)
        /repo/gcc-trunk/gcc/rtl-error.cc:108
0x7cdcd3 _fatal_insn_not_found(rtx_def const*, char const*, int, char const*)
        /repo/gcc-trunk/gcc/rtl-error.cc:116
0x7be8c6 extract_insn(rtx_insn*)
        /repo/gcc-trunk/gcc/recog.cc:2882
0xe6f4ef instantiate_virtual_regs_in_insn
        /repo/gcc-trunk/gcc/function.cc:1612
0xe6f4ef instantiate_virtual_regs
        /repo/gcc-trunk/gcc/function.cc:1995
0xe6f4ef execute
        /repo/gcc-trunk/gcc/function.cc:2042
Please submit a full bug report, with preprocessed source (by using
-freport-bug).
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.

$ armv7a-hardfloat-linux-gnueabi-gcc -v
Using built-in specs.
COLLECT_GCC=/repo/gcc-trunk/binary-latest-armv7a-hardfloat/bin/armv7a-hardfloat-linux-gnueabi-gcc
COLLECT_LTO_WRAPPER=/repo/gcc-trunk/binary-trunk-20250131094006-r15-7305-gdecc6c0d4d909c-checking-yes-rtl-df-extra-armv7a-hardfloat/bin/../libexec/gcc/armv7a-hardfloat-linux-gnueabi/15.0.1/lto-wrapper
Target: armv7a-hardfloat-linux-gnueabi
Configured with: /repo/gcc-trunk//configure --enable-languages=c,c++
--enable-valgrind-annotations --disable-nls --enable-checking=yes,rtl,df,extra
--with-cloog --with-ppl --with-isl --enable-libsanitizer --with-float=hard
--with-fpu=vfpv4 --with-arch=armv7-a
--with-sysroot=/usr/armv7a-hardfloat-linux-gnueabi --build=x86_64-pc-linux-gnu
--host=x86_64-pc-linux-gnu --target=armv7a-hardfloat-linux-gnueabi
--with-ld=/usr/bin/armv7a-hardfloat-linux-gnueabi-ld
--with-as=/usr/bin/armv7a-hardfloat-linux-gnueabi-as --disable-libstdcxx-pch
--prefix=/repo/gcc-trunk//binary-trunk-20250131094006-r15-7305-gdecc6c0d4d909c-checking-yes-rtl-df-extra-armv7a-hardfloat
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 15.0.1 20250131 (experimental) (GCC)

Reply via email to