From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 14B0A3858C60; Tue, 6 Feb 2024 23:28:24 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 14B0A3858C60 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1707262104; bh=cahEwF+HAZjAA3Y4rs0wGm1Y+W2ZA8FifvTdsLt0EQg=; h=From:To:Subject:Date:From; b=u8X16KfpAHBJxjKbrSACNNwOJtrQeYCf6iTYVpe+fJvH9Kajs9QAWZHFY5j0BZia3 9c+Pc7eyX+uzpXi3yzlqgyMJvO6WbfOhpmh8QwevxZ9IwxqaFms4bDPF/JYyUtVzFe OlOQWBPUfOvFmskCeSCIwBxzlTnJsjj9srn8r2w8= From: "manfred99 at gmx dot ch" To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/113793] New: malloc abort on character allocate with source argument Date: Tue, 06 Feb 2024 23:28:23 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: fortran X-Bugzilla-Version: unknown X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: manfred99 at gmx dot ch X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter target_milestone Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D113793 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=3D" ") ALLOCATE(b(100),source=3D" ") END yields: malloc(): corrupted top size When doing a lame indirection: CHARACTER*30,allocatable :: a(:),b(:) CHARACTER*30 :: c=3D" " ALLOCATE(a(100),source=3Dc) ALLOCATE(b(100),source=3Dc) 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.=