summaryrefslogtreecommitdiff
path: root/gcc/fortran/trans-expr.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/fortran/trans-expr.c')
-rw-r--r--gcc/fortran/trans-expr.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/gcc/fortran/trans-expr.c b/gcc/fortran/trans-expr.c
index 62ba93203cd..8d81f2b3216 100644
--- a/gcc/fortran/trans-expr.c
+++ b/gcc/fortran/trans-expr.c
@@ -40,7 +40,7 @@ along with GCC; see the file COPYING3. If not see
#include "trans-stmt.h"
#include "dependency.h"
#include "gimplify.h"
-
+#include "wide-int.h"
/* Convert a scalar to an array descriptor. To be used for assumed-rank
arrays. */
@@ -2082,13 +2082,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);
@@ -2627,7 +2628,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
+ || !tree_fits_uhwi_p (len)
|| !POINTER_TYPE_P (TREE_TYPE (str)))
return NULL_TREE;
@@ -2741,8 +2742,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)))
{