public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/113793] New: malloc abort on character allocate with source argument
@ 2024-02-06 23:28 manfred99 at gmx dot ch
  2024-02-07 19:35 ` [Bug fortran/113793] " anlauf at gcc dot gnu.org
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: manfred99 at gmx dot ch @ 2024-02-06 23:28 UTC (permalink / raw)
  To: gcc-bugs

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.

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2024-04-16 18:59 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-06 23:28 [Bug fortran/113793] New: malloc abort on character allocate with source argument manfred99 at gmx dot ch
2024-02-07 19:35 ` [Bug fortran/113793] " anlauf at gcc dot gnu.org
2024-02-07 22:09 ` anlauf at gcc dot gnu.org
2024-04-11 20:29 ` anlauf at gcc dot gnu.org
2024-04-12 20:28 ` anlauf at gcc dot gnu.org
2024-04-12 20:29 ` anlauf at gcc dot gnu.org
2024-04-13 18:04 ` anlauf at gcc dot gnu.org
2024-04-16 16:48 ` cvs-commit at gcc dot gnu.org
2024-04-16 18:59 ` anlauf at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).