diff options
Diffstat (limited to 'gcc/rust/backend/rust-constexpr.cc')
-rw-r--r-- | gcc/rust/backend/rust-constexpr.cc | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/gcc/rust/backend/rust-constexpr.cc b/gcc/rust/backend/rust-constexpr.cc index bfd7d95..0ed56c7 100644 --- a/gcc/rust/backend/rust-constexpr.cc +++ b/gcc/rust/backend/rust-constexpr.cc @@ -1901,6 +1901,9 @@ eval_constant_expression (const constexpr_ctx *ctx, tree t, bool lval, location_t loc = EXPR_LOCATION (t); + if (t == NULL_TREE) + return NULL_TREE; + if (CONSTANT_CLASS_P (t)) { if (TREE_OVERFLOW (t)) @@ -2697,10 +2700,8 @@ eval_store_expression (const constexpr_ctx *ctx, tree t, bool lval, } if (TREE_CODE (probe) == ARRAY_REF) { - // TODO - rust_unreachable (); - // elt = eval_and_check_array_index (ctx, probe, false, - // non_constant_p, overflow_p); + elt = eval_and_check_array_index (ctx, probe, false, + non_constant_p, overflow_p); if (*non_constant_p) return t; } @@ -2929,8 +2930,13 @@ eval_store_expression (const constexpr_ctx *ctx, tree t, bool lval, } } + if (*non_constant_p) + return t; + /* Don't share a CONSTRUCTOR that might be changed later. */ init = unshare_constructor (init); + if (init == NULL_TREE) + return t; if (*valp && TREE_CODE (*valp) == CONSTRUCTOR && TREE_CODE (init) == CONSTRUCTOR) @@ -3585,9 +3591,6 @@ eval_call_expression (const constexpr_ctx *ctx, tree t, bool lval, result = *ctx->global->values.get (res); if (result == NULL_TREE && !*non_constant_p) { - if (!ctx->quiet) - error ("%<constexpr%> call flows off the end " - "of the function"); *non_constant_p = true; } } |