Skip to content
Snippets Groups Projects
Commit 65c8fd7b authored by Jakub Jelinek's avatar Jakub Jelinek Committed by Jakub Jelinek
Browse files

gimple-fold: Fix up fold_array_ctor_reference RAW_DATA_CST handling [PR118207]

The following testcases ICE because fold_array_ctor_reference in the
RAW_DATA_CST handling just return build_int_cst without actually checking
that if type is non-NULL, TREE_TYPE (val) is uselessly convertible to it.

By falling through the code after it without *suboff += we get everything
we need, the two if conditionals will never be true (we've already
checked that size == BITS_PER_UNIT and so can't be 0, and val will be
INTEGER_CST), but it will do the important fold_ctor_reference call
which will deal with type incompatibilities.

2024-12-28  Jakub Jelinek  <jakub@redhat.com>

	PR tree-optimization/118207
	* gimple-fold.cc (fold_array_ctor_reference): For RAW_DATA_CST,
	just set val to build_int_cst and fall through to the normal
	element handling code instead of returning build_int_cst right away.

	* gcc.dg/pr118207.c: New test.
parent a326ecf5
No related branches found
No related tags found
No related merge requests found
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment