aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-data-ref.c
diff options
context:
space:
mode:
authorRichard Biener <rguenther@suse.de>2021-01-22 11:29:17 +0100
committerRichard Biener <rguenther@suse.de>2021-01-22 12:49:46 +0100
commit8bad25eb56bd16f3482f856a75b1c1ae5cfe1c4f (patch)
treeee7343ed598d84768a69000931c1c0efd02b6c3a /gcc/tree-data-ref.c
parent36fe1cdc9534c36c02803ce97557130354d2b2a0 (diff)
downloadgcc-8bad25eb56bd16f3482f856a75b1c1ae5cfe1c4f.zip
gcc-8bad25eb56bd16f3482f856a75b1c1ae5cfe1c4f.tar.gz
gcc-8bad25eb56bd16f3482f856a75b1c1ae5cfe1c4f.tar.bz2
middle-end/98773 - always sign extend CHREC_RIGHT
The previous change exposed a miscompile when trying to interpret CHREC_RIGHT correctly which in fact it already was to the extent it is used. The following reverts this part of the change, only retaining the singling out of HOST_WIDE_INT_MIN. 2021-01-22 Richard Biener <rguenther@suse.de> PR middle-end/98773 * tree-data-ref.c (initalize_matrix_A): Revert previous change, retaining failing on HOST_WIDE_INT_MIN CHREC_RIGHT. * gcc.dg/torture/pr98773.c: New testcase.
Diffstat (limited to 'gcc/tree-data-ref.c')
-rw-r--r--gcc/tree-data-ref.c17
1 files changed, 3 insertions, 14 deletions
diff --git a/gcc/tree-data-ref.c b/gcc/tree-data-ref.c
index d19c5eb..124a7be 100644
--- a/gcc/tree-data-ref.c
+++ b/gcc/tree-data-ref.c
@@ -3924,21 +3924,10 @@ initialize_matrix_A (lambda_matrix A, tree chrec, unsigned index, int mult)
switch (TREE_CODE (chrec))
{
case POLYNOMIAL_CHREC:
- /* CHREC_RIGHT and its negated value should fit in a lambda_int.
- Pointer typed chrecs right are to be interpreted signed. */
HOST_WIDE_INT chrec_right;
- if (POINTER_TYPE_P (chrec_type (chrec)))
- {
- if (!cst_and_fits_in_hwi (CHREC_RIGHT (chrec)))
- return chrec_dont_know;
- chrec_right = int_cst_value (CHREC_RIGHT (chrec));
- }
- else
- {
- if (!tree_fits_shwi_p (CHREC_RIGHT (chrec)))
- return chrec_dont_know;
- chrec_right = tree_to_shwi (CHREC_RIGHT (chrec));
- }
+ if (!cst_and_fits_in_hwi (CHREC_RIGHT (chrec)))
+ return chrec_dont_know;
+ chrec_right = int_cst_value (CHREC_RIGHT (chrec));
/* We want to be able to negate without overflow. */
if (chrec_right == HOST_WIDE_INT_MIN)
return chrec_dont_know;