diff options
author | Eric Botcazou <ebotcazou@adacore.com> | 2019-02-08 11:20:23 +0000 |
---|---|---|
committer | Eric Botcazou <ebotcazou@gcc.gnu.org> | 2019-02-08 11:20:23 +0000 |
commit | cc26a3bdef0ff3d5fb1026bc080857f1c5e42f56 (patch) | |
tree | 542eb040aafda23fa59f3480b44177fec52c1556 /gcc/ada/gcc-interface/utils.c | |
parent | 0850f23b69439560c36b0be88ff8e1e3ef4a9ef6 (diff) | |
download | gcc-cc26a3bdef0ff3d5fb1026bc080857f1c5e42f56.zip gcc-cc26a3bdef0ff3d5fb1026bc080857f1c5e42f56.tar.gz gcc-cc26a3bdef0ff3d5fb1026bc080857f1c5e42f56.tar.bz2 |
utils.c (max_size): Be prepared for an operand with VOID_TYPE.
* gcc-interface/utils.c (max_size) <tcc_unary>: Be prepared for an
operand with VOID_TYPE.
From-SVN: r268675
Diffstat (limited to 'gcc/ada/gcc-interface/utils.c')
-rw-r--r-- | gcc/ada/gcc-interface/utils.c | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/gcc/ada/gcc-interface/utils.c b/gcc/ada/gcc-interface/utils.c index 2ff664b..65b7e0f 100644 --- a/gcc/ada/gcc-interface/utils.c +++ b/gcc/ada/gcc-interface/utils.c @@ -3642,7 +3642,10 @@ fntype_same_flags_p (const_tree t, tree cico_list, bool return_unconstrained_p, /* EXP is an expression for the size of an object. If this size contains discriminant references, replace them with the maximum (if MAX_P) or - minimum (if !MAX_P) possible value of the discriminant. */ + minimum (if !MAX_P) possible value of the discriminant. + + Note that the expression may have already been gimplified,in which case + COND_EXPRs have VOID_TYPE and no operands, and this must be handled. */ tree max_size (tree exp, bool max_p) @@ -3714,11 +3717,15 @@ max_size (tree exp, bool max_p) return build_int_cst (type, max_p ? 1 : 0); case tcc_unary: + op0 = TREE_OPERAND (exp, 0); + if (code == NON_LVALUE_EXPR) - return max_size (TREE_OPERAND (exp, 0), max_p); + return max_size (op0, max_p); + + if (VOID_TYPE_P (TREE_TYPE (op0))) + return max_p ? TYPE_MAX_VALUE (type) : TYPE_MIN_VALUE (type); - op0 = max_size (TREE_OPERAND (exp, 0), - code == NEGATE_EXPR ? !max_p : max_p); + op0 = max_size (op0, code == NEGATE_EXPR ? !max_p : max_p); if (op0 == TREE_OPERAND (exp, 0)) return exp; |