https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108354
--- Comment #5 from Andrew Pinski <pinskia at gcc dot gnu.org> --- (In reply to Andrew Pinski from comment #4) > raised STORAGE_ERROR : stack overflow or erroneous memory access 0x00000000015769b4 in get_range_query (fun=<optimized out>) at /home/apinski/src/upstream-gcc/gcc/gcc/value-query.h:143 143 return fun->x_range_query ? fun->x_range_query : &global_ranges; (gdb) bt #0 0x00000000015769b4 in get_range_query (fun=<optimized out>) at /home/apinski/src/upstream-gcc/gcc/gcc/value-query.h:143 #1 ssa_name_has_boolean_range(tree_node*) () at /home/apinski/src/upstream-gcc/gcc/gcc/tree-ssanames.cc:534 #2 0x0000000001ae01a6 in generic_simplify_MINUS_EXPR(unsigned int, tree_code, tree_node*, tree_node*, tree_node*) [clone .constprop.0] () at /home/apinski/src/upstream-gcc/gcc/gcc/tree.h:3654 #3 0x0000000000fb1286 in fold_binary_loc(unsigned int, tree_code, tree_node*, tree_node*, tree_node*) () at /home/apinski/src/upstream-gcc/gcc/gcc/fold-const.cc:10926 #4 0x0000000000fb8eeb in fold_build2_loc (loc=loc@entry=0, code=code@entry=MINUS_EXPR, type=0x7ffff725c000, op0=op0@entry=0x7ffff7242d50, op1=op1@entry=0x7ffff52a6870) at /home/apinski/src/upstream-gcc/gcc/gcc/fold-const.cc:13824 #5 0x0000000000f7373f in get_inner_reference(tree_node*, poly_int_pod<1u, long>*, poly_int_pod<1u, long>*, tree_node**, machine_mode*, int*, int*, int*) () at /home/apinski/src/upstream-gcc/gcc/gcc/tree.h:3645 #6 0x00000000010a2546 in (anonymous namespace)::isra_analyze_call(cgraph_edge*) () at /home/apinski/src/upstream-gcc/gcc/gcc/ipa-sra.cc:2167 #7 0x00000000010a32a8 in (anonymous namespace)::isra_analyze_all_outgoing_calls (node=<error reading variable: dwarf2_find_location_expression: Corrupted DWARF expression.>) at /home/apinski/src/upstream-gcc/gcc/gcc/ipa-sra.cc:2202 #8 ipa_sra_summarize_function(cgraph_node*) () at /home/apinski/src/upstream-gcc/gcc/gcc/ipa-sra.cc:4540 #9 0x00000000010a5558 in (anonymous namespace)::ipa_sra_generate_summary() () at /home/apinski/src/upstream-gcc/gcc/gcc/ipa-sra.cc:2716 #10 0x0000000001242f23 in execute_ipa_summary_passes (ipa_pass=0x3a90670) at /home/apinski/src/upstream-gcc/gcc/gcc/passes.cc:2297 (gdb) p cfun $3 = (function *) 0x0 Ok, let me mark the pattern only for GIMPLE because it looks like we are calling fold without setting cfun and still passing a SSA_NAME. I suspect we might run into this issue with other code too but at least I hide the latent bug ...