https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80965
Bug ID: 80965 Summary: ICE with class argument and -O2 optimization Product: gcc Version: 7.0.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: fortran Assignee: unassigned at gcc dot gnu.org Reporter: david.sagan at gmail dot com Target Milestone: --- Consider the code: module mode3_mod contains subroutine xyz(loc) implicit none class(*) :: loc real X(6) integer ix_use select type (loc) type is (integer) x = 0 type is (real) ix_use = 0 end select end subroutine xyz end module mode3_mod Compiling with -O2 optimization gives an error: Davids-Mac-mini:~/Bmad/test> gfortran -c -O2 mode3_mod.f90 mode3_mod.f90:24:0: end subroutine xyz internal compiler error: in compare_values_warnv, at tree-vrp.c:1223 mode3_mod.f90:24:0: internal compiler error: Abort trap: 6 gfortran: internal compiler error: Abort trap: 6 (program f951) I am running on a Mac (10.12.5) with gcc version: gcc (MacPorts gcc7 7-20170420_0) 7.0.1 20170420 (prerelease)