+2019-06-07 Jason Merrill <jason@redhat.com>
+
+ * constexpr.c (cxx_eval_constant_expression): Call
+ STRIP_ANY_LOCATION_WRAPPER early.
+ [CONVERT_EXPR]: Don't build anything for conversion to void.
+ [ADDR_EXPR]: ggc_free unused ADDR_EXPR.
+
2019-06-05 Martin Sebor <msebor@redhat.com>
PR c/90737
bool *non_constant_p, bool *overflow_p,
tree *jump_target /* = NULL */)
{
- constexpr_ctx new_ctx;
- tree r = t;
-
if (jump_target && *jump_target)
{
/* If we are jumping, ignore all statements/expressions except those
*non_constant_p = true;
return t;
}
+
+ STRIP_ANY_LOCATION_WRAPPER (t);
+
if (CONSTANT_CLASS_P (t))
{
if (TREE_OVERFLOW (t))
}
/* Avoid excessively long constexpr evaluations. */
- if (!location_wrapper_p (t)
- && ++*ctx->constexpr_ops_count >= constexpr_ops_limit)
+ if (++*ctx->constexpr_ops_count >= constexpr_ops_limit)
{
if (!ctx->quiet)
error_at (cp_expr_loc_or_loc (t, input_location),
return t;
}
+ constexpr_ctx new_ctx;
+ tree r = t;
+
tree_code tcode = TREE_CODE (t);
switch (tcode)
{
/* This function does more aggressive folding than fold itself. */
r = build_fold_addr_expr_with_type (op, TREE_TYPE (t));
if (TREE_CODE (r) == ADDR_EXPR && TREE_OPERAND (r, 0) == oldop)
- return t;
+ {
+ ggc_free (r);
+ return t;
+ }
break;
}
r = op;
else if (tcode == UNARY_PLUS_EXPR)
r = fold_convert (TREE_TYPE (t), op);
+ else if (VOID_TYPE_P (type))
+ r = void_node;
else
r = fold_build1 (tcode, type, op);