In the following program, pointer association is not allowd.
But I can compile successfully, and get the output of random character
string whose length is 999.

I think this is wrong behavior.

program char_array_const
  implicit none
  character(len=999), pointer :: p
  character(len=12), target :: string = "test string"

  p => string
  print *, trim(p)
end program


-- 
           Summary: Character pointer can associated with not the same
                    length character variable.
           Product: gcc
           Version: 4.0.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: iguchi at coral dot t dot u-tokyo dot ac dot jp


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25030

Reply via email to