https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71862
Bug ID: 71862 Summary: ICE in gfc_add_component_ref, at fortran/class.c:241 Product: gcc Version: 7.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: fortran Assignee: unassigned at gcc dot gnu.org Reporter: gerhard.steinmetz.fort...@t-online.de Target Milestone: --- Release versions (5, 6, 7) are bailed out, with no backtrace. Experimental versions (6, 7 tested) give a backtrace. $ cat z1.f90 program p type t integer :: n = 0 integer, pointer :: q => null() end type type(t) :: x print *, associated(x%q) x = f() print *, associated(x%q) contains function f() result (z) class(t) :: z print *, associated(z%q) end end $ gfortran-6 z1.f90 z1.f90:11:26: function f() result (z) 1 Error: CLASS variable 'z' at (1) must be dummy, allocatable or pointer (null):0: confused by earlier errors, bailing out $ gfortran-7-20160710 z1.f90 z1.f90:11:26: function f() result (z) 1 Error: CLASS variable 'z' at (1) must be dummy, allocatable or pointer f951: internal compiler error: in gfc_add_component_ref, at fortran/class.c:241 0x66ac54 gfc_add_component_ref(gfc_expr*, char const*) ../../gcc/fortran/class.c:241 0x6ead24 resolve_ordinary_assign ../../gcc/fortran/resolve.c:9751 0x6ead24 gfc_resolve_code(gfc_code*, gfc_namespace*) ../../gcc/fortran/resolve.c:10570 0x6eb272 resolve_codes ../../gcc/fortran/resolve.c:15667 0x6eb361 gfc_resolve(gfc_namespace*) ../../gcc/fortran/resolve.c:15701 0x6d668a resolve_all_program_units ../../gcc/fortran/parse.c:5853 0x6d668a gfc_parse_file() ../../gcc/fortran/parse.c:6105 0x718d12 gfc_be_parse_file ../../gcc/fortran/f95-lang.c:198