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

            Bug ID: 113793
           Summary: malloc abort on character allocate with source
                    argument
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: manfred99 at gmx dot ch
  Target Milestone: ---

Allocating an allocatable character array, I get a malloc error
when the source argument is not properly padded:

      CHARACTER*30,allocatable :: a(:),b(:)
      ALLOCATE(a(100),source=" ")
      ALLOCATE(b(100),source=" ")
      END

yields:
malloc(): corrupted top size


When doing a lame indirection:
      CHARACTER*30,allocatable :: a(:),b(:)
      CHARACTER*30 :: c=" "
      ALLOCATE(a(100),source=c)
      ALLOCATE(b(100),source=c)
      END

everything is fine.
I don't know whether this is mandated by the standard, but the error
message is not very user friendly and hard to grasp.

I would have expected that the source argument is automatically padded
as with variable assignments and function call arguments.

Reply via email to