https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81819
Bug ID: 81819 Summary: [7 Regression][RX] internal compiler error: in rx_is_restricted_memory_address, at config/rx/rx.c:311 Product: gcc Version: 7.1.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: regression Assignee: unassigned at gcc dot gnu.org Reporter: olegendo at gcc dot gnu.org Target Milestone: --- This error shows up when building a bigger app on RX with LTO. It is working OK on GCC 6. /usr/local/rx-elf/include/c++/7.1.1/bits/char_traits.h: In function 'mount_partition.constprop': /usr/local/rx-elf/include/c++/7.1.1/bits/char_traits.h:264:41: internal compiler error: in rx_is_restricted_memory_address, at config/rx/rx.c:311 return __builtin_memcmp(__s1, __s2, __n); ^ 0xb69733 rx_is_restricted_memory_address(rtx_def*, machine_mode) ../../gcc-7-branch/gcc/config/rx/rx.c:311 0xc576f3 rx_restricted_mem_operand(rtx_def*, machine_mode) ../../gcc-7-branch/gcc/config/rx/predicates.md:54 0xc57757 rx_source_operand(rtx_def*, machine_mode) ../../gcc-7-branch/gcc/config/rx/predicates.md:61 0x82aae2 insn_operand_matches(insn_code, unsigned int, rtx_def*) ../../gcc-7-branch/gcc/optabs.c:6874 0x82aae2 prepare_operand(insn_code, rtx_def*, int, machine_mode, machine_mode, int) ../../gcc-7-branch/gcc/optabs.c:3965 0x82ace5 prepare_cmp_insn ../../gcc-7-branch/gcc/optabs.c:3874 0x82b766 emit_cmp_and_jump_insns(rtx_def*, rtx_def*, rtx_code, rtx_def*, machine_mode, int, rtx_def*, int) ../../gcc-7-branch/gcc/optabs.c:4051 0x60a4de do_compare_rtx_and_jump(rtx_def*, rtx_def*, rtx_code, int, machine_mode, rtx_def*, rtx_code_label*, rtx_code_label*, int) ../../gcc-7-branch/gcc/dojump.c:1145 0x68086e compare_by_pieces_d::generate(rtx_def*, rtx_def*, machine_mode) ../../gcc-7-branch/gcc/expr.c:1455 0x6819b3 op_by_pieces_d::run() ../../gcc-7-branch/gcc/expr.c:1090 0x68a88b compare_by_pieces ../../gcc-7-branch/gcc/expr.c:1517 0x68a88b emit_block_cmp_hints(rtx_def*, rtx_def*, rtx_def*, tree_node*, rtx_def*, bool, rtx_def* (*)(void*, long, machine_mode), void*) ../../gcc-7-branch/gcc/expr.c:1970 0x59255a expand_builtin_memcmp ../../gcc-7-branch/gcc/builtins.c:4234 0x59255a expand_builtin(tree_node*, rtx_def*, rtx_def*, machine_mode, int) ../../gcc-7-branch/gcc/builtins.c:6760 0x686b34 expand_expr_real_1(tree_node*, rtx_def*, machine_mode, expand_modifier, rtx_def**, bool) ../../gcc-7-branch/gcc/expr.c:10821 0x68ee70 store_expr_with_bounds(tree_node*, rtx_def*, int, bool, bool, tree_node*) ../../gcc-7-branch/gcc/expr.c:5552 0x68fbdf expand_assignment(tree_node*, tree_node*, bool) ../../gcc-7-branch/gcc/expr.c:5321 0x5aa03a expand_call_stmt ../../gcc-7-branch/gcc/cfgexpand.c:2656 0x5aa03a expand_gimple_stmt_1 ../../gcc-7-branch/gcc/cfgexpand.c:3571 0x5aa03a expand_gimple_stmt ../../gcc-7-branch/gcc/cfgexpand.c:3737 Unfortunately, I don't know how to get a reproducer for that. The function 'rx_is_restricted_memory_address' gets an (subreg:SI (reg/v:DI 236 [ name ]) 4) as 'rtx mem' argument, which is not handled by the code. The following makes the ICE go away, but I haven't tested whether the resulting code runs properly. Index: gcc/config/rx/rx.c =================================================================== --- gcc/config/rx/rx.c (revision 251045) +++ gcc/config/rx/rx.c (working copy) @@ -284,6 +284,9 @@ /* Simple memory addresses are OK. */ return true; + case SUBREG: + return RX_REG_P (SUBREG_REG (mem)); + case PRE_DEC: case POST_INC: return false;