Hi, PR 124260 is about dereferencing a NULL "index" tree when traversing static constructors of global variables. As discussed in the bug, it is unclear whether that is allowed but ObjC compiler creates these at least on 32bit hosts. Ian plans to fix this in the FE in the next stage1 but for this stage4, such entries can be easily skipped in ipa-prop (too). The collected information is used for speculative "devirtualization" ony and so if we miss a relevant entry, it may only result in a "bad" decision whether to do that or not.
I have bootstrapped and tested the patch on x86_64-linux and Ian verified it fixs the issue for him. Honza approved the patch in prerson (after asking me to add a comment). I will commit the patch shortly. Thanks, Martin gcc/ChangeLog: 2026-03-11 Martin Jambor <[email protected]> PR objc/124260 * ipa-prop.cc (ipa_analyze_var_static_initializer): Skip a constructor entry if its index is NULL. --- gcc/ipa-prop.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/gcc/ipa-prop.cc b/gcc/ipa-prop.cc index 385912c3790..e5b401b9d3f 100644 --- a/gcc/ipa-prop.cc +++ b/gcc/ipa-prop.cc @@ -3637,7 +3637,8 @@ ipa_analyze_var_static_initializer (varpool_node *node) val) { if (TREE_CODE (val) != ADDR_EXPR - || TREE_CODE (TREE_OPERAND (val, 0)) != FUNCTION_DECL) + || TREE_CODE (TREE_OPERAND (val, 0)) != FUNCTION_DECL + || !index) continue; HOST_WIDE_INT elt_offset = int_bit_position (index); if ((elt_offset % BITS_PER_UNIT) != 0) -- 2.52.0
