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

anlauf at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |anlauf at gcc dot gnu.org
     Ever confirmed|0                           |1
   Last reconfirmed|                            |2024-02-07
           Keywords|                            |wrong-code
             Status|UNCONFIRMED                 |NEW

--- Comment #1 from anlauf at gcc dot gnu.org ---
(In reply to Manfred Schwarb from comment #0)
> 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

Confirmed.

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

The dump-tree shows that it is padded, but the actual malloc is too short:

            a.data = (void * restrict) __builtin_malloc (100);

Omitting the source= part, we get the expected:

            a.data = (void * restrict) __builtin_malloc (3000);

Reply via email to