Created attachment 56679 [details] a module triggerring a segmentation fault The attached source code for a fortran module triggers a segmentation fault when compiling ``` bug_mod.f90:24:39: 24 | list_char = obj%get_char_list() | 1 internal compiler error: Segmentation fault 0xd432a1 internal_error(char const*, ...) ???:0 0xe409f5 fold_convert_loc(unsigned int, tree_node*, tree_node*) ???:0 0x15e8f14 gfc_trans_create_temp_array(stmtblock_t*, stmtblock_t*, gfc_ss*, tree_node*, tree_node*, bool, bool, bool, locus*) ???:0 0x1631d79 gfc_conv_procedure_call(gfc_se*, gfc_symbol*, gfc_actual_arglist*, gfc_expr*, vec<tree_node*, va_gc, vl_embed>*) ???:0 0x15f5151 gfc_conv_loop_setup(gfc_loopinfo*, locus*) ???:0 0x161d4f8 gfc_generate_function_code(gfc_namespace*) ???:0 0x15e7f29 gfc_generate_module_code(gfc_namespace*) ???:0 0x157973b gfc_parse_file() ???:0 Please submit a full bug report, with preprocessed source if appropriate. Please include the complete backtrace with any bug report. See <file:///usr/share/doc/gcc-11/README.Bugs> for instructions. ``` I've been able to reproduce it with - latest version of gfortran from the archlinux repository: core/gcc-fortran 13.2.1-3 - older version from ubuntu 22.04 : Ubuntu 11.4.0-1ubuntu1~22.04
The testcase has some similarity with reduced versions of pr93678 and also the same traceback. Thus likely related. Note: replacing the rank-1 result variable character(len=1) :: list(1) by a scalar character(len=1) :: list !(1) avoids the ICE.
Among the things that avoid the ICE: - Using a subroutine instead of a function - not using a type procedure but a regular function - wrapping the list of char in a custom type - returning a list of a real numbers Among the things that do not avoid the ICE: - replacing the fixed length array with a pointer or an allocatable