https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88304
--- Comment #15 from Harald Anlauf <anlauf at gmx dot de> --- (In reply to Jakub Jelinek from comment #14) > Author: jakub > Date: Thu Dec 6 10:28:31 2018 > New Revision: 266847 > > URL: https://gcc.gnu.org/viewcvs?rev=266847&root=gcc&view=rev This fixes the original testcase, but not the following variant, which crashes with a similar backtrace: MODULE mo_occ implicit none integer :: ncid contains function nf90_inquire_dimension(ncid, dimid, name, len) integer, intent( in) :: ncid, dimid character(*), optional, intent(out) :: name integer, optional, intent(out) :: len integer :: nf90_inquire_dimension end function nf90_inquire_dimension subroutine read_gpsro_netcdf () contains function dimlen (dim) integer ,intent(in) :: dim integer :: dimlen integer :: status integer :: dimids (10) status = nf90_Inquire_Dimension (ncid, dimids(dim), len=dimlen) end function dimlen end subroutine read_gpsro_netcdf end module mo_occ % gfc-trunk -c gfcbug152-v3.f90 gfcbug152-v3.f90:11:0: 11 | subroutine read_gpsro_netcdf () | internal compiler error: tree check: expected tree that contains 'decl common' structure, have 'mem_ref' in use_pointer_in_frame, at tree-nested.c:267 0x5ed193 tree_contains_struct_check_failed(tree_node const*, tree_node_structure_enum, char const*, int, char const*) ../../trunk/gcc/tree.c:9929 0xd44250 contains_struct_check(tree_node*, tree_node_structure_enum, char const*, int, char const*) ../../trunk/gcc/tree.h:3271 0xd44250 use_pointer_in_frame ../../trunk/gcc/tree-nested.c:267 0xd4a745 convert_local_reference_stmt ../../trunk/gcc/tree-nested.c:2327 0x9d8a56 walk_gimple_stmt(gimple_stmt_iterator*, tree_node* (*)(gimple_stmt_iterator*, bool*, walk_stmt_info*), tree_node* (*)(tree_node**, int*, void*), walk_stmt_info*) ../../trunk/gcc/gimple-walk.c:568 0x9d8c70 walk_gimple_seq_mod(gimple**, tree_node* (*)(gimple_stmt_iterator*, bool*, walk_stmt_info*), tree_node* (*)(tree_node**, int*, void*), walk_stmt_info*) ../../trunk/gcc/gimple-walk.c:51 0x9d8bb1 walk_gimple_stmt(gimple_stmt_iterator*, tree_node* (*)(gimple_stmt_iterator*, bool*, walk_stmt_info*), tree_node* (*)(tree_node**, int*, void*), walk_stmt_info*) ../../trunk/gcc/gimple-walk.c:631 0x9d8c70 walk_gimple_seq_mod(gimple**, tree_node* (*)(gimple_stmt_iterator*, bool*, walk_stmt_info*), tree_node* (*)(tree_node**, int*, void*), walk_stmt_info*) ../../trunk/gcc/gimple-walk.c:51 0x9d8b11 walk_gimple_stmt(gimple_stmt_iterator*, tree_node* (*)(gimple_stmt_iterator*, bool*, walk_stmt_info*), tree_node* (*)(tree_node**, int*, void*), walk_stmt_info*) ../../trunk/gcc/gimple-walk.c:595 0x9d8c70 walk_gimple_seq_mod(gimple**, tree_node* (*)(gimple_stmt_iterator*, bool*, walk_stmt_info*), tree_node* (*)(tree_node**, int*, void*), walk_stmt_info*) ../../trunk/gcc/gimple-walk.c:51 0xd440c8 walk_body ../../trunk/gcc/tree-nested.c:703 0xd44118 walk_function ../../trunk/gcc/tree-nested.c:714 0xd44118 walk_all_functions ../../trunk/gcc/tree-nested.c:779 0xd4e094 lower_nested_functions(tree_node*) ../../trunk/gcc/tree-nested.c:3482 0x836330 cgraph_node::analyze() ../../trunk/gcc/cgraphunit.c:673 0x8397b9 analyze_functions ../../trunk/gcc/cgraphunit.c:1126 0x83a8a2 symbol_table::finalize_compilation_unit() ../../trunk/gcc/cgraphunit.c:2835