The call to gimple_call_fntype() in gimple_call_return_type() may return NULL, which causes the TREE_TYPE(lhs) to ICE. I think it would be best to return NULL (or void_type_node) rather than aborting.
I'm running into this because fold_using_range::range_of_call, calls gimple_call_return_type which may ICE for builtins with no LHS. Instead of special casing things in range_of_call, perhaps it's best to plug the source. Does this sound reasonable? gcc/ChangeLog: * gimple.h (gimple_call_return_type): Return NULL when no type and no lhs is available. --- gcc/gimple.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/gcc/gimple.h b/gcc/gimple.h index e7dc2a45a13..2a01fe631ec 100644 --- a/gcc/gimple.h +++ b/gcc/gimple.h @@ -3182,7 +3182,10 @@ gimple_call_return_type (const gcall *gs) tree type = gimple_call_fntype (gs); if (type == NULL_TREE) - return TREE_TYPE (gimple_call_lhs (gs)); + { + tree lhs = gimple_call_lhs (gs); + return lhs ? TREE_TYPE (lhs) : NULL_TREE; + } /* The type returned by a function is the type of its function type. */ -- 2.31.1