public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/96091] New: ICE during dom: tree check: expected integer_cst, have poly_int_cst in to_wide, at tree.h:5911
@ 2020-07-07 3:30 qianchao9 at huawei dot com
2020-07-07 3:32 ` [Bug tree-optimization/96091] " qianchao9 at huawei dot com
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: qianchao9 at huawei dot com @ 2020-07-07 3:30 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96091
Bug ID: 96091
Summary: ICE during dom: tree check: expected integer_cst, have
poly_int_cst in to_wide, at tree.h:5911
Product: gcc
Version: 11.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: tree-optimization
Assignee: unassigned at gcc dot gnu.org
Reporter: qianchao9 at huawei dot com
Target Milestone: ---
Created attachment 48840
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=48840&action=edit
fix-gimple-fold
Compiling this with -S -ftree-vectorize -march=armv8.5-a+sve -O2
-mno-strict-align -ftracer:
void foo(short a[], short m)
{
int i, j;
int f1[10];
short nc;
nc = m + 1;
for (i = 0, j = m; i < nc; i++, j--)
{
a[i] = f1[i];
a[j] = i;
}
return;
}
gives:
during GIMPLE pass: dom
testcase.c: In function ‘foo’:
testcase.c:1:6: internal compiler error: tree check: expected integer_cst, have
poly_int_cst in to_wide, at tree.h:5911
1 | void foo(short a[], short m)
| ^~~
0x17714fb tree_check_failed(tree_node const*, char const*, int, char const*,
...)
../../gcc/tree.c:9685
0x9ebf7f tree_int_cst_elt_check(tree_node const*, int, char const*, int, char
const*)
../../gcc/tree.h:3491
0xa3d5bf wi::to_wide(tree_node const*)
../../gcc/tree.h:5911
0x17787ff vector_cst_int_elt(tree_node const*, unsigned int)
../../gcc/tree.c:10964
0x1778a33 vector_cst_elt(tree_node const*, unsigned int)
../../gcc/tree.c:10991
0xdfa553 vec_cst_ctor_to_array
../../gcc/fold-const.c:9795
0xdfa9d7 fold_vec_perm(tree_node*, tree_node*, tree_node*, vec_perm_indices
const&)
../../gcc/fold-const.c:9836
0x1c85c27 generic_simplify_VEC_PERM_EXPR
/home/qianchao/opt/gccRepo/gcc/build/gcc/generic-match.c:75993
0x1c86c37 generic_simplify(unsigned int, tree_code, tree_node*, tree_node*,
tree_node*, tree_node*)
/home/qianchao/opt/gccRepo/gcc/build/gcc/generic-match.c:76143
0xe0703f fold_ternary_loc(unsigned int, tree_code, tree_node*, tree_node*,
tree_node*, tree_node*)
../../gcc/fold-const.c:12116
0x190eb43 gimple_resimplify3
../../gcc/gimple-match-head.c:354
0x1910bfb gimple_simplify(gimple*, gimple_match_op*, gimple**, tree_node*
(*)(tree_node*), tree_node* (*)(tree_node*))
../../gcc/gimple-match-head.c:1001
0xe86493 gimple_fold_stmt_to_constant_1(gimple*, tree_node* (*)(tree_node*),
tree_node* (*)(tree_node*))
../../gcc/gimple-fold.c:6329
0x1658c1f record_temporary_equivalences_from_stmts_at_dest
../../gcc/tree-ssa-threadedge.c:362
0x165a8db thread_through_normal_block
../../gcc/tree-ssa-threadedge.c:1064
0x165b363 thread_across_edge
../../gcc/tree-ssa-threadedge.c:1372
0x165b537 thread_outgoing_edges(basic_block_def*, gcond*, const_and_copies*,
avail_exprs_stack*, evrp_range_analyzer*, tree_node* (*)(gimple*, gimple*,
avail_exprs_stack*, basic_block_def*))
../../gcc/tree-ssa-threadedge.c:1440
0x14f53bb dom_opt_dom_walker::after_dom_children(basic_block_def*)
../../gcc/tree-ssa-dom.c:1548
0x21663b7 dom_walker::walk(basic_block_def*)
../../gcc/domwalk.c:352
0x14f2df7 execute
../../gcc/tree-ssa-dom.c:724
...
The testcase failed to get unencoded elts in vector_cst during dom3, as the
vector_cst needs integer_cst elements. Howerver, the reason for ICE is that we
should not fold vector constructor that contains poly_int_cst elements to
vector_cst.
the following fixes the latent bug - we faild to limit folding poly_int_cst
constructor
diff --git a/gcc/gimple-fold.c b/gcc/gimple-fold.c
index 4e3de95d2d2..679a6770676 100644
--- a/gcc/gimple-fold.c
+++ b/gcc/gimple-fold.c
@@ -438,7 +438,7 @@ fold_gimple_assign (gimple_stmt_iterator *si)
tree val;
FOR_EACH_CONSTRUCTOR_VALUE (CONSTRUCTOR_ELTS (rhs), i, val)
- if (! CONSTANT_CLASS_P (val))
+ if (! CONSTANT_CLASS_P (val) || POLY_INT_CST_P (val))
return NULL_TREE;
return build_vector_from_ctor (TREE_TYPE (rhs),
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug tree-optimization/96091] ICE during dom: tree check: expected integer_cst, have poly_int_cst in to_wide, at tree.h:5911
2020-07-07 3:30 [Bug tree-optimization/96091] New: ICE during dom: tree check: expected integer_cst, have poly_int_cst in to_wide, at tree.h:5911 qianchao9 at huawei dot com
@ 2020-07-07 3:32 ` qianchao9 at huawei dot com
2020-07-07 7:30 ` rguenth at gcc dot gnu.org
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: qianchao9 at huawei dot com @ 2020-07-07 3:32 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96091
--- Comment #1 from Qian Chao <qianchao9 at huawei dot com> ---
Bootstrap and tested on aarch64 platform. No new regression witnessed.
Any suggestions?
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug tree-optimization/96091] ICE during dom: tree check: expected integer_cst, have poly_int_cst in to_wide, at tree.h:5911
2020-07-07 3:30 [Bug tree-optimization/96091] New: ICE during dom: tree check: expected integer_cst, have poly_int_cst in to_wide, at tree.h:5911 qianchao9 at huawei dot com
2020-07-07 3:32 ` [Bug tree-optimization/96091] " qianchao9 at huawei dot com
@ 2020-07-07 7:30 ` rguenth at gcc dot gnu.org
2020-07-07 7:39 ` rsandifo at gcc dot gnu.org
2021-12-12 13:18 ` pinskia at gcc dot gnu.org
3 siblings, 0 replies; 5+ messages in thread
From: rguenth at gcc dot gnu.org @ 2020-07-07 7:30 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96091
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |rsandifo at gcc dot gnu.org
--- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> ---
Why should we not have a VECTOR_CST of POLY_INT_CST elements? If POLY_INT_CST
is not "constant" then it shouldn't be tcc_constant? Looks like
tree
vector_cst_elt (const_tree t, unsigned int i)
{
...
/* Otherwise work out the value from the last two encoded elements. */
return wide_int_to_tree (TREE_TYPE (TREE_TYPE (t)),
vector_cst_int_elt (t, i));
}
should be using poly-ints and not wide-ints. Richard?
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug tree-optimization/96091] ICE during dom: tree check: expected integer_cst, have poly_int_cst in to_wide, at tree.h:5911
2020-07-07 3:30 [Bug tree-optimization/96091] New: ICE during dom: tree check: expected integer_cst, have poly_int_cst in to_wide, at tree.h:5911 qianchao9 at huawei dot com
2020-07-07 3:32 ` [Bug tree-optimization/96091] " qianchao9 at huawei dot com
2020-07-07 7:30 ` rguenth at gcc dot gnu.org
@ 2020-07-07 7:39 ` rsandifo at gcc dot gnu.org
2021-12-12 13:18 ` pinskia at gcc dot gnu.org
3 siblings, 0 replies; 5+ messages in thread
From: rsandifo at gcc dot gnu.org @ 2020-07-07 7:39 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96091
--- Comment #3 from rsandifo at gcc dot gnu.org <rsandifo at gcc dot gnu.org> ---
(In reply to Richard Biener from comment #2)
> Why should we not have a VECTOR_CST of POLY_INT_CST elements? If
> POLY_INT_CST
> is not "constant" then it shouldn't be tcc_constant? Looks like
>
> tree
> vector_cst_elt (const_tree t, unsigned int i)
> {
> ...
> /* Otherwise work out the value from the last two encoded elements. */
> return wide_int_to_tree (TREE_TYPE (TREE_TYPE (t)),
> vector_cst_int_elt (t, i));
> }
>
> should be using poly-ints and not wide-ints. Richard?
Yeah, looks like it. I think I was worried about cases
in which we could end up with poly_int*poly_int, from a
poly_int-long vector containing a poly_int “stepped”
vector constant. But that's not a problem here, since
the index is always a plain integer.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug tree-optimization/96091] ICE during dom: tree check: expected integer_cst, have poly_int_cst in to_wide, at tree.h:5911
2020-07-07 3:30 [Bug tree-optimization/96091] New: ICE during dom: tree check: expected integer_cst, have poly_int_cst in to_wide, at tree.h:5911 qianchao9 at huawei dot com
` (2 preceding siblings ...)
2020-07-07 7:39 ` rsandifo at gcc dot gnu.org
@ 2021-12-12 13:18 ` pinskia at gcc dot gnu.org
3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-12-12 13:18 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96091
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Resolution|--- |DUPLICATE
Status|UNCONFIRMED |RESOLVED
--- Comment #4 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
This was fixed in GCC 10.4 and 11.1.0 as a dup of bug 97141.
*** This bug has been marked as a duplicate of bug 97141 ***
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2021-12-12 13:18 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-07 3:30 [Bug tree-optimization/96091] New: ICE during dom: tree check: expected integer_cst, have poly_int_cst in to_wide, at tree.h:5911 qianchao9 at huawei dot com
2020-07-07 3:32 ` [Bug tree-optimization/96091] " qianchao9 at huawei dot com
2020-07-07 7:30 ` rguenth at gcc dot gnu.org
2020-07-07 7:39 ` rsandifo at gcc dot gnu.org
2021-12-12 13:18 ` pinskia at gcc dot gnu.org
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).