https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113866
kargl at gcc dot gnu.org changed: What |Removed |Added ---------------------------------------------------------------------------- Last reconfirmed| |2024-02-10 Ever confirmed|0 |1 Priority|P3 |P4 Status|UNCONFIRMED |NEW CC| |kargl at gcc dot gnu.org --- Comment #1 from kargl at gcc dot gnu.org --- Reduced testcase. module bindcchar contains subroutine bindc_optional(c1, c3) bind(c) character(*), optional :: c1, c3(100) print *, c1(1:3), c3(5)(1:3) end subroutine subroutine not_bindc_optional(c1, c3) character(*), optional :: c1, c3(100) call bindc_optional(c1, c3) end subroutine end module Note, the OPTIONAL attribute is required to cause the ICE. Note, -Wall generates a few warnings. Perhaps, these should be errors. % gfcx -c -Wall fr.f90 fr.f90:5:34: 5 | subroutine bindc_optional(c1, c3) bind(c) | 1 Warning: Variable ‘c1’ at (1) is a dummy argument of the BIND(C) procedure ‘bindc_optional’ but may not be C interoperable [-Wc-binding-type] fr.f90:5:38: 5 | subroutine bindc_optional(c1, c3) bind(c) | 1 Warning: Variable ‘c3’ at (1) is a dummy argument of the BIND(C) procedure ‘bindc_optional’ but may not be C interoperable [-Wc-binding-type] fr.f90:12:36: 12 | call bindc_optional(c1, c3) | 1