[Bug fortran/64933] ASSOCIATE on a character variable does not allow substring expressions

pault at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Tue Nov 1 15:15:00 GMT 2016


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64933

--- Comment #4 from Paul Thomas <pault at gcc dot gnu.org> ---
Created attachment 39941
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=39941&action=edit
Draft Patch for the PR

Bootstraps and regtests on FC21/x86_64. This testcase runs fine:

program test_this
  implicit none
  character(len = 15) :: char_var, char_var_dim (3)
  character(len = 80) :: buffer

! Original failing case reported in PR
  ASSOCIATE(should_work=>char_var)
    should_work = "test succesful"
    write (buffer, *) should_work(5:14)
  END ASSOCIATE

  if (trim (buffer) .ne. "  succesful") call abort

! Found to be failing during debugging
  ASSOCIATE(should_work=>char_var_dim)
    should_work = ["test SUCCESFUL", "test_SUCCESFUL", "test.SUCCESFUL"]
    write (buffer, *) should_work(:)(5:14)
  END ASSOCIATE

  if (trim (buffer) .ne. "  SUCCESFUL_SUCCESFUL.SUCCESFUL") call abort

! Found to be failing during debugging
  ASSOCIATE(should_work=>char_var_dim(1:2))
    should_work = ["test SUCCESFUL", "test_SUCCESFUL", "test.SUCCESFUL"]
    write (buffer, *) should_work(:)(5:14)
  END ASSOCIATE

  if (trim (buffer) .ne. "  SUCCESFUL_SUCCESFUL") call abort

end program

I'll submit and commit this weekend.

Paul


More information about the Gcc-bugs mailing list