On 7/15/21 3:06 PM, Richard Biener wrote:
On Thu, Jul 15, 2021 at 1:06 PM Aldy Hernandez <al...@redhat.com> wrote:

Well, if we don't adjust gimple_call_return_type() to handle built-ins
with no LHS, then we must adjust the callers.

The attached patch fixes gimple_expr_type() per it's documentation:

/* Return the type of the main expression computed by STMT.  Return
    void_type_node if the statement computes nothing.  */

Currently gimple_expr_type is ICEing because it calls gimple_call_return_type.

I still think gimple_call_return_type should return void_type_node
instead of ICEing, but this will also fix my problem.

Anyone have a problem with this?

It's still somewhat inconsistent, no?  Because for a call without a LHS
it's now either void_type_node or the type of the return value.

It's probably known I dislike gimple_expr_type itself (it was introduced
to make the transition to tuples easier).  I wonder why you can't simply
fix range_of_call to do

    tree lhs = gimple_call_lhs (call);
    if (lhs)
      type = TREE_TYPE (lhs);

That would still leave gimple_expr_type() broken. It's comment clearly says it should return void_type_node.

I still think we should just fix gimple_call_return_type to return void_type_node instead of ICEing.

Reply via email to