[Bug tree-optimization/94784] ICE: in simplify_vector_constructor, at tree-ssa-forwprop.c:2482

2020-04-27 Thread rsandifo at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94784

rsandifo at gcc dot gnu.org  changed:

   What|Removed |Added

 CC||rsandifo at gcc dot gnu.org
 Resolution|--- |FIXED
 Status|UNCONFIRMED |RESOLVED

--- Comment #4 from rsandifo at gcc dot gnu.org  
---
Fixed on trunk.

[Bug tree-optimization/94784] ICE: in simplify_vector_constructor, at tree-ssa-forwprop.c:2482

2020-04-27 Thread cvs-commit at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94784

--- Comment #3 from CVS Commits  ---
The master branch has been updated by Richard Sandiford :

https://gcc.gnu.org/g:5328710be314dee43da8027dbff547d48b85e35e

commit r10-7987-g5328710be314dee43da8027dbff547d48b85e35e
Author: Fei Yang 
Date:   Mon Apr 27 11:08:04 2020 +0100

forwprop: Fix ICE when building an identity constructor [PR94784]

In the testcase for PR94784, we have two vectors with the same ABI identity
but with different TYPE_MODEs. It would be better to flip the assert around
so that it checks that the two vectors have equal TYPE_VECTOR_SUBPARTS and
that converting the corresponding element types is a
useless_type_conversion_p.

2020-04-27  Felix Yang  

gcc/
PR tree-optimization/94784
* tree-ssa-forwprop.c (simplify_vector_constructor): Flip the
assert around so that it checks that the two vectors have equal
TYPE_VECTOR_SUBPARTS and that converting the corresponding element
types is a useless_type_conversion_p.

gcc/testsuite/
PR tree-optimization/94784
* gcc.dg/pr94784.c: New test.

[Bug tree-optimization/94784] ICE: in simplify_vector_constructor, at tree-ssa-forwprop.c:2482

2020-04-27 Thread felix.yang at huawei dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94784

--- Comment #2 from Fei Yang  ---
Will propose a patch for review.

[Bug tree-optimization/94784] ICE: in simplify_vector_constructor, at tree-ssa-forwprop.c:2482

2020-04-27 Thread felix.yang at huawei dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94784

--- Comment #1 from Fei Yang  ---
I did some check and it looks like everything works fine before the ICE.

The reason for the assert is that applying VIEW_CONVERT_EXPR to two general
vectors is dangerous in this context.  If through some bug we ended up with one
vector being V4HI and the other being V2SI (say), the assert stops us from
silently miscompiling the code.

In the testcase we have two vectors with the same ABI identity but with
different TYPE_MODEs. As suggested by Richard Sandiford, it would be better to
flip the assert around so that it checks that the two vectors have equal
TYPE_VECTOR_SUBPARTS and that converting the corresponding element types is a
useless_type_conversion_p.