https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78053
Bug ID: 78053 Summary: [OOP] SELECT TYPE on CLASS(*) component for deferred length char arrays ICEs for -O > 0 Product: gcc Version: 7.0 Status: UNCONFIRMED Severity: minor Priority: P3 Component: fortran Assignee: unassigned at gcc dot gnu.org Reporter: vehre at gcc dot gnu.org Target Milestone: --- Created attachment 39852 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=39852&action=edit Testprogram causing ICE with -On n>0 The test program: program test_gimp type container class(*), allocatable :: items(:) end type type(container), allocatable :: a_list(:) select type (x=>a_list(1)%items) type is (character(len=:)) if (any(x /= ["bla", "foo", "bar"])) call abort() end select end ICEs when compiled with any optimization level greater than 0. The ICE is somewhere in the SSA_NAME resolution stage. But I assume the cause is way earlier, because at the location of the error, the routine that contains the SELECT TYPE is not in the dumps (-fdump-tree-all) anymore. I therefore assume, that some information on the temporary representation of the char-array is not set correctly leading to some optimization step terminating without giving a proper message.