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

             Bug #: 53357
           Summary: Add -fcheck=bounds for character type-spec in ALLOCATE
    Classification: Unclassified
           Product: gcc
           Version: 4.8.0
            Status: UNCONFIRMED
          Keywords: diagnostic
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassig...@gcc.gnu.org
        ReportedBy: bur...@gcc.gnu.org


Example: The following is invalid as the length does not match:

integer :: i
i = 5
block
  character(len=i), allocatable :: str
  allocate (character(len=3) :: str)
end block
end

 * * *

That's already correctly detected for compile-time constants:
  character(len=5), allocatable :: str
  allocate (character(len=3) :: str)
  end

Error: Allocating str at (1) with type-spec requires the same character-length
parameter as in the declaration


However, the compile-time version could also print the bounds.

Reply via email to