aboutsummaryrefslogtreecommitdiff
path: root/gcc/builtins.c
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2019-11-05 11:17:29 +0100
committerJakub Jelinek <jakub@gcc.gnu.org>2019-11-05 11:17:29 +0100
commitf05b372429ba6fa6e2bba0f4145a11e8e4aee5cd (patch)
treec10d0f620692a606831b5a38c9ddb69da11443ce /gcc/builtins.c
parent81012684569cfb64b0274f117d68740cde52ffdd (diff)
downloadgcc-f05b372429ba6fa6e2bba0f4145a11e8e4aee5cd.zip
gcc-f05b372429ba6fa6e2bba0f4145a11e8e4aee5cd.tar.gz
gcc-f05b372429ba6fa6e2bba0f4145a11e8e4aee5cd.tar.bz2
re PR tree-optimization/91945 (ICE: tree check: expected integer_cst, have var_decl in get_len, at tree.h:5837 since r274997)
PR tree-optimization/91945 * builtins.c (compute_objsize): For ARRAY_REF, only multiply off by tpsize if it is both non-NULL and INTEGER_CST, otherwise punt. Formatting fix. * gfortran.dg/pr91945.f90: New test. From-SVN: r277820
Diffstat (limited to 'gcc/builtins.c')
-rw-r--r--gcc/builtins.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/gcc/builtins.c b/gcc/builtins.c
index 5d811f1..c8fa86f 100644
--- a/gcc/builtins.c
+++ b/gcc/builtins.c
@@ -3626,7 +3626,7 @@ compute_objsize (tree dest, int ostype, tree *pdecl /* = NULL */)
}
}
else if (TREE_CODE (off) == SSA_NAME
- && INTEGRAL_TYPE_P (TREE_TYPE (off)))
+ && INTEGRAL_TYPE_P (TREE_TYPE (off)))
{
wide_int min, max;
enum value_range_kind rng = get_range_info (off, &min, &max);
@@ -3680,7 +3680,8 @@ compute_objsize (tree dest, int ostype, tree *pdecl /* = NULL */)
if (TREE_CODE (dest) == ARRAY_REF)
{
tree eltype = TREE_TYPE (dest);
- if (tree tpsize = TYPE_SIZE_UNIT (eltype))
+ tree tpsize = TYPE_SIZE_UNIT (eltype);
+ if (tpsize && TREE_CODE (tpsize) == INTEGER_CST)
off = fold_build2 (MULT_EXPR, size_type_node, off, tpsize);
else
return NULL_TREE;