https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87893

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jakub at gcc dot gnu.org

--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
When trying to cp_fold pair::pair(&p) ctor call, guess related to arm ABI
feature of returning pointer to the object from the ctor,
2542            if (callee && DECL_DECLARED_CONSTEXPR_P (callee)
2543                && !flag_no_inline)
2544              r = maybe_constant_value (x);
returns for some reason a VOID_CST and then
2549                if (DECL_CONSTRUCTOR_P (callee))
2550                  {
2551                    loc = EXPR_LOCATION (x);
2552                    tree s = build_fold_indirect_ref_loc (loc,
2553                                                          CALL_EXPR_ARG (x,
0));
2554                    r = build2_loc (loc, INIT_EXPR, TREE_TYPE (s), s, r);
2555                  }
tries to initialize the class with that.  VOID_CST is a result of the ctor call
constexpr evaluation doing:
          if (DECL_CONSTRUCTOR_P (fun))
            /* This can be null for a subobject constructor call, in
               which case what we care about is the initialization
               side-effects rather than the value.  We could get at the
               value by evaluating *this, but we don't bother; there's
               no need to put such a call in the hash table.  */
            result = lval ? ctx->object : ctx->ctor;
where for some reason both ctx->object and ctx->ctor are NULL and then
      else if (!result)
        result = void_node;
both in cxx_eval_call_expression.  No idea why that happens though and why
pair::pair(&p) call isn't being folded at all on the same testcase on
x86_64-linux.

Reply via email to