Created attachment 42156 [details] preprocessed source that triggers the issue Building allmodconfig linux kernel for xtensa results in ICE: drivers/staging/rtl8188eu/core/rtw_ap.c:445:1: internal compiler error: in change_address_1, at emit-rtl.c:2126 } ^ 0x6a3e2f change_address_1 ../../../gcc-6.1.0/gcc/emit-rtl.c:2126 0x6a66a2 adjust_address_1(rtx_def*, machine_mode, long, int, int, int, long) ../../../gcc-6.1.0/gcc/emit-rtl.c:2264 0xb6f521 xtensa_split_operand_pair(rtx_def**, machine_mode) ../../../gcc-6.1.0/gcc/config/xtensa/xtensa.c:994 0xc08b3e gen_split_1(rtx_insn*, rtx_def**) ../../../gcc-6.1.0/gcc/config/xtensa/xtensa.md:743 0x6a81b4 try_split(rtx_def*, rtx_insn*, int) ../../../gcc-6.1.0/gcc/emit-rtl.c:3658 CC [M] drivers/staging/rtl8188eu/hal/rtl8188eu_recv.o 0x8ab411 split_insn ../../../gcc-6.1.0/gcc/recog.c:2865 0x8af037 split_all_insns() ../../../gcc-6.1.0/gcc/recog.c:2955 0x8af0b2 rest_of_handle_split_after_reload ../../../gcc-6.1.0/gcc/recog.c:3891 0x8af0b2 execute ../../../gcc-6.1.0/gcc/recog.c:3920 Reproducible with the attached preprocessed source and the following command line: cc1 -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -fshort-wchar -Werror-implicit-function-declaration -Wno-format-security -std=gnu89 -fno-PIE -ffreestanding -mlongcalls -mforce-no-pic -fno-delete-null-pointer-checks -Wno-frame-address -O2 --param=allow-store-data-races=0 -DCC_HAVE_ASM_GOTO -fno-reorder-blocks -fno-ipa-cp-clone -fno-partial-inlining -Wframe-larger-than=1024 -fno-stack-protector -Wno-unused-but-set-variable -Wno-unused-const-variable -fno-omit-frame-pointer -fno-optimize-sibling-calls -fno-var-tracking-assignments -fno-inline-functions-called-once -Wdeclaration-after-statement -Wno-pointer-sign -fno-strict-overflow -fconserve-stack -Werror=implicit-int -Werror=strict-prototypes -Werror=date-time -Werror=incompatible-pointer-types -Werror=designated-init rtw_ap.i
The issue happens in the splitter movdi_internal in the call chain xtensa_split_operand_pair -> adjust_address_1 -> change_address_1, in line gcc_assert (memory_address_addr_space_p (mode, addr, as)); The original DI object in memory is not fully addressable: it starts at the offset 1020 of its base register, so its second word may not be reached by l32i/s32i. Fix xtensa_mem_offset so that only DI object address completely addressable by 32-bit load/store instructions is considered legitimate.
With the current gcc mainline compiling the reproducer source results in different ICE: drivers/staging/rtl8188eu/core/rtw_ap.c: In function ‘expire_timeout_chk’: drivers/staging/rtl8188eu/core/rtw_ap.c:266:41: internal compiler error: Segmentation fault if ((psta->sta_stats.last_rx_data_pkts + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^ psta->sta_stats.last_rx_ctrl_pkts) == ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 0xe6f4ab crash_signal ../../gcc/gcc/toplev.c:341 0xd11ec7 expand_binop(machine_mode, optab_tag, rtx_def*, rtx_def*, rtx_def*, int, optab_methods) ../../gcc/gcc/optabs.c:1137 0xd1397e expand_binop(machine_mode, optab_tag, rtx_def*, rtx_def*, rtx_def*, int, optab_methods) ../../gcc/gcc/optabs.c:1632 0xa4385d expand_expr_real_2(separate_ops*, rtx_def*, machine_mode, expand_modifier) ../../gcc/gcc/expr.c:9613 0x8dcf75 expand_gimple_stmt_1 ../../gcc/gcc/cfgexpand.c:3691 0x8dd1c7 expand_gimple_stmt ../../gcc/gcc/cfgexpand.c:3751 0x8e4667 expand_gimple_basic_block ../../gcc/gcc/cfgexpand.c:5750 0x8e5e85 execute ../../gcc/gcc/cfgexpand.c:6357 I'll open a different PR for that.
Author: jcmvbkbc Date: Mon Sep 11 21:33:36 2017 New Revision: 251986 URL: https://gcc.gnu.org/viewcvs?rev=251986&root=gcc&view=rev Log: xtensa: fix PR target/82181 2017-09-11 Max Filippov <jcmvbkbc@gmail.com> gcc/ * config/xtensa/xtensa.c (xtensa_mem_offset): Check that both words of E_DImode object are reachable by xtensa_uimm8x4 access. Modified: trunk/gcc/ChangeLog trunk/gcc/config/xtensa/xtensa.c
Author: jcmvbkbc Date: Mon Sep 11 21:44:42 2017 New Revision: 251987 URL: https://gcc.gnu.org/viewcvs?rev=251987&root=gcc&view=rev Log: xtensa: fix PR target/82181 2017-09-11 Max Filippov <jcmvbkbc@gmail.com> gcc/ Backport from mainline * config/xtensa/xtensa.c (xtensa_mem_offset): Check that both words of DImode object are reachable by xtensa_uimm8x4 access. Modified: branches/gcc-7-branch/gcc/ChangeLog branches/gcc-7-branch/gcc/config/xtensa/xtensa.c
Author: jcmvbkbc Date: Mon Sep 11 21:49:34 2017 New Revision: 251989 URL: https://gcc.gnu.org/viewcvs?rev=251989&root=gcc&view=rev Log: xtensa: fix PR target/82181 2017-09-11 Max Filippov <jcmvbkbc@gmail.com> gcc/ Backport from mainline * config/xtensa/xtensa.c (xtensa_mem_offset): Check that both words of DImode object are reachable by xtensa_uimm8x4 access. Modified: branches/gcc-6-branch/gcc/ChangeLog branches/gcc-6-branch/gcc/config/xtensa/xtensa.c
Author: jcmvbkbc Date: Mon Sep 11 21:53:38 2017 New Revision: 251990 URL: https://gcc.gnu.org/viewcvs?rev=251990&root=gcc&view=rev Log: xtensa: fix PR target/82181 2017-09-11 Max Filippov <jcmvbkbc@gmail.com> gcc/ Backport from mainline * config/xtensa/xtensa.c (xtensa_mem_offset): Check that both words of DImode object are reachable by xtensa_uimm8x4 access. Modified: branches/gcc-5-branch/gcc/ChangeLog branches/gcc-5-branch/gcc/config/xtensa/xtensa.c
The fixes are committed to trunk and to 5.x, 6.x and 7.x branches.