https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95854
Bug ID: 95854
Summary: ICE in find_bswap_or_nop_1 of pass store-merging
Product: gcc
Version: 11.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: tree-optimization
Assignee: unassigned at gcc dot gnu.org
Reporter: zhoukaipeng3 at huawei dot com
Target Milestone: ---
ICE log:
during GIMPLE pass: store-merging
pr87132.c: In function ‘main’:
pr87132.c:5:5: internal compiler error: in tree_to_uhwi, at tree.c:7332
5 | int main()
| ^~~~
0xfc2fcf tree_to_uhwi(tree_node const*)
../.././gcc/tree.c:7332
0xfc2fcf tree_to_uhwi(tree_node const*)
../.././gcc/tree.c:7330
0x169420b find_bswap_or_nop_1
../.././gcc/gimple-ssa-store-merging.c:602
0x1696c1b find_bswap_or_nop_1
../.././gcc/gimple-ssa-store-merging.c:589
0x1696c1b process_store
../.././gcc/gimple-ssa-store-merging.c:4773
0x1696c1b execute
../.././gcc/gimple-ssa-store-merging.c:4996
Command: gcc -S -march=armv8.5-a+sve2 -fno-vect-cost-model -fno-tree-scev-cprop
-O3 -ftracer pr87132.c
GCC version: gcc version 11.0.0 20200618 (experimental) (GCC)
The problem occurs in find_bswap_or_nop_1.
The stmt is "_27 = BIT_FIELD_REF <vect__2.16_92, 32, POLY_INT_CST [96, 128]>".
So "tree_to_uhwi (TREE_OPERAND (rhs1, 2))" failed.
I plan to add a judgement before to make sure both TREE_OPERAND (rhs1, 1) and
TREE_OPERAND (rhs1, 2) are INTEGER_CST.