X-Git-Url: http://git.ipfire.org/?a=blobdiff_plain;f=gcc%2Ffortran%2Ftrans-expr.c;h=7cf9bc18d38c6a478de44496901bef20ffb81705;hb=fe5ad9266cba2cbb611a831aaac450d3f6decd0c;hp=41b2f94679ab6f5e4d863b3553a05980f5a70f94;hpb=8c53c46cebf42cb4f4ac125ca6428c5e9b519f66;p=thirdparty%2Fgcc.git diff --git a/gcc/fortran/trans-expr.c b/gcc/fortran/trans-expr.c index 41b2f94679ab..7cf9bc18d38c 100644 --- a/gcc/fortran/trans-expr.c +++ b/gcc/fortran/trans-expr.c @@ -41,7 +41,7 @@ along with GCC; see the file COPYING3. If not see #include "dependency.h" #include "gimple.h" #include "gimplify.h" - +#include "wide-int.h" /* Convert a scalar to an array descriptor. To be used for assumed-rank arrays. */ @@ -2083,13 +2083,14 @@ gfc_conv_cst_int_power (gfc_se * se, tree lhs, tree rhs) HOST_WIDE_INT m; unsigned HOST_WIDE_INT n; int sgn; + wide_int wrhs = rhs; /* If exponent is too large, we won't expand it anyway, so don't bother with large integer values. */ - if (!TREE_INT_CST (rhs).fits_shwi ()) + if (!wi::fits_shwi_p (wrhs)) return 0; - m = TREE_INT_CST (rhs).to_shwi (); + m = wrhs.to_shwi (); /* There's no ABS for HOST_WIDE_INT, so here we go. It also takes care of the asymmetric range of the integer type. */ n = (unsigned HOST_WIDE_INT) (m < 0 ? -m : m); @@ -2628,7 +2629,7 @@ gfc_string_to_single_character (tree len, tree str, int kind) { if (len == NULL - || !INTEGER_CST_P (len) || TREE_INT_CST_HIGH (len) != 0 + || !cst_fits_uhwi_p (len) || !POINTER_TYPE_P (TREE_TYPE (str))) return NULL_TREE; @@ -2644,8 +2645,8 @@ gfc_string_to_single_character (tree len, tree str, int kind) && TREE_CODE (TREE_OPERAND (TREE_OPERAND (str, 0), 0)) == STRING_CST && array_ref_low_bound (TREE_OPERAND (str, 0)) == TREE_OPERAND (TREE_OPERAND (str, 0), 1) - && TREE_INT_CST_LOW (len) > 1 - && TREE_INT_CST_LOW (len) + && tree_to_uhwi (len) > 1 + && tree_to_uhwi (len) == (unsigned HOST_WIDE_INT) TREE_STRING_LENGTH (TREE_OPERAND (TREE_OPERAND (str, 0), 0))) { @@ -2742,8 +2743,9 @@ gfc_optimize_len_trim (tree len, tree str, int kind) && TREE_CODE (TREE_OPERAND (TREE_OPERAND (str, 0), 0)) == STRING_CST && array_ref_low_bound (TREE_OPERAND (str, 0)) == TREE_OPERAND (TREE_OPERAND (str, 0), 1) - && TREE_INT_CST_LOW (len) >= 1 - && TREE_INT_CST_LOW (len) + && tree_fits_uhwi_p (len) + && tree_to_uhwi (len) >= 1 + && tree_to_uhwi (len) == (unsigned HOST_WIDE_INT) TREE_STRING_LENGTH (TREE_OPERAND (TREE_OPERAND (str, 0), 0))) {