https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102621
Bug ID: 102621 Summary: [12 Regression] ICE in convert_nonlocal_reference_op, at tree-nested.c:1166 Product: gcc Version: 12.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: fortran Assignee: unassigned at gcc dot gnu.org Reporter: gs...@t-online.de Target Milestone: --- Changed between 20210523 and 20210530 : (contained function f is never referenced) $ cat z1.f90 program p integer :: a(8) !$omp task affinity (iterator(j=1:8) : a(j)) !$omp end task contains integer function f(x) class(*) :: x end end $ cat z2.f90 program p integer :: a(8) !$omp task affinity (iterator(j=1:8) : a(j)) !$omp end task end $ gfortran-12-20211003 -c z2.f90 -fopenmp $ $ gfortran-12-20211003 -c z1.f90 -fopenmp z1.f90:1:9: 1 | program p | ^ internal compiler error: Segmentation fault 0xd41bdf crash_signal ../../gcc/toplev.c:331 0xdd51b3 convert_nonlocal_reference_op ../../gcc/tree-nested.c:1166 0xfd9892 walk_tree_1(tree_node**, tree_node* (*)(tree_node**, int*, void*), void*, hash_set<tree_node*, false, default_hash_traits<tree_node*> >*, tree_node* (*)(tree_node**, int*, tree_node* (*)(tree_node**, int*, void*), void*, hash_set<tree_node*, false, default_hash_traits<tree_node*> >*)) ../../gcc/tree.c:11016 0xab6f3d walk_gimple_op(gimple*, tree_node* (*)(tree_node**, int*, void*), walk_stmt_info*) ../../gcc/gimple-walk.c:221 0xab7168 walk_gimple_stmt(gimple_stmt_iterator*, tree_node* (*)(gimple_stmt_iterator*, bool*, walk_stmt_info*), tree_node* (*)(tree_node**, int*, void*), walk_stmt_info*) ../../gcc/gimple-walk.c:620 0xab7310 walk_gimple_seq_mod(gimple**, tree_node* (*)(gimple_stmt_iterator*, bool*, walk_stmt_info*), tree_node* (*)(tree_node**, int*, void*), walk_stmt_info*) ../../gcc/gimple-walk.c:51 0xab71f1 walk_gimple_stmt(gimple_stmt_iterator*, tree_node* (*)(gimple_stmt_iterator*, bool*, walk_stmt_info*), tree_node* (*)(tree_node**, int*, void*), walk_stmt_info*) ../../gcc/gimple-walk.c:629 0xab7310 walk_gimple_seq_mod(gimple**, tree_node* (*)(gimple_stmt_iterator*, bool*, walk_stmt_info*), tree_node* (*)(tree_node**, int*, void*), walk_stmt_info*) ../../gcc/gimple-walk.c:51 0xab71d9 walk_gimple_stmt(gimple_stmt_iterator*, tree_node* (*)(gimple_stmt_iterator*, bool*, walk_stmt_info*), tree_node* (*)(tree_node**, int*, void*), walk_stmt_info*) ../../gcc/gimple-walk.c:665 0xab7310 walk_gimple_seq_mod(gimple**, tree_node* (*)(gimple_stmt_iterator*, bool*, walk_stmt_info*), tree_node* (*)(tree_node**, int*, void*), walk_stmt_info*) ../../gcc/gimple-walk.c:51 0xab71f1 walk_gimple_stmt(gimple_stmt_iterator*, tree_node* (*)(gimple_stmt_iterator*, bool*, walk_stmt_info*), tree_node* (*)(tree_node**, int*, void*), walk_stmt_info*) ../../gcc/gimple-walk.c:629 0xab7310 walk_gimple_seq_mod(gimple**, tree_node* (*)(gimple_stmt_iterator*, bool*, walk_stmt_info*), tree_node* (*)(tree_node**, int*, void*), walk_stmt_info*) ../../gcc/gimple-walk.c:51 0xdd1da8 walk_body ../../gcc/tree-nested.c:811 0xdd24e8 walk_function ../../gcc/tree-nested.c:822 0xdd24e8 walk_all_functions ../../gcc/tree-nested.c:887 0xdd75e0 lower_nested_functions(tree_node*) ../../gcc/tree-nested.c:3732 0x95284d cgraph_node::analyze() ../../gcc/cgraphunit.c:676 0x9553f7 analyze_functions ../../gcc/cgraphunit.c:1234 0x955dbd symbol_table::finalize_compilation_unit() ../../gcc/cgraphunit.c:2508