https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83704
Bug ID: 83704 Summary: pr31243 revisited Product: gcc Version: 8.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: fortran Assignee: unassigned at gcc dot gnu.org Reporter: dominiq at lps dot ens.fr CC: jb at gcc dot gnu.org Target Milestone: --- Revision r256284 makes the request in pr31243 obsolete for 64-bit mode. On the positive side, -fcheck=bounds now works for the test in comment 9. On the negative side, the following test compiles now but its behavior at run time is not the one I expect: subroutine foo(i) integer(kind=8), intent(in) :: i character(len=i) :: x print *, i print *, len(x, kind=8) end subroutine foo program main character (len=2_8**32_8+4_8) :: ch character (len=4) :: a1, a2 ch = '123456789' a1 = ch(1:4) ch(2_8**32_8:2_8**32_8+3_8) = 'abcd' a2 = ch(2_8**32_8:2_8**32_8+4_8) print *, "'",a1,"', '",a2,"'" print *, "'", ch(1:2_8**32_8+3_8), "'" print *, len(ch, kind=8) print *, len(ch(1:2_8**32_8+3_8), kind=8) call foo(2_8**32_8+4_8) end program main The output is '1234', 'abcd' '123' 4294967300 4294967299 Illegal instruction i.e., print *, "'", ch(1:2_8**32_8+3_8), "'" prints only the first three characters of the 'ch' substring and not the entire substring. In addition, if I comment the line print *, len(x, kind=8) the Illegal instruction is no longer present in the output '1234', 'abcd' '123' 4294967300 4294967299 4294967300