On 2/15/23 14:50, Andrew Pinski wrote:
Hi, While fixing PR 108354, I came across that ssa_name_has_boolean_range calls get_range_query with cfun as the argument but sometimes while in IPA passes cfun is currently nullptr. The question should we check the argument before calling get_range_query or is it a valid thing to call it with a nullptr (and have it return global_ranges in that case)?
That might be ok... personally I see nothing wrong with: diff --git a/gcc/value-query.h b/gcc/value-query.h index 63878968118..2d7bf8fcf33 100644 --- a/gcc/value-query.h +++ b/gcc/value-query.h @@ -140,7 +140,7 @@ get_global_range_query () ATTRIBUTE_RETURNS_NONNULL inline range_query * get_range_query (const struct function *fun) { - return fun->x_range_query ? fun->x_range_query : &global_ranges; + return (fun && fun->x_range_query) ? fun->x_range_query : &global_ranges; } // Query the global range of NAME in function F. Default to cfun. The client is probably going to do that anyway. Aldy?