From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id A65313858C66; Wed, 7 Feb 2024 22:09:05 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A65313858C66 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1707343745; bh=O91/4xFgxwkmvACMpYvV/sIhwPyCciD6CRGuIJrs+SI=; h=From:To:Subject:Date:In-Reply-To:References:From; b=VnWLBjzYydhYmISu2/yg2+tQE4uRxOLEw8LD5VaFh5pYVxzZ+AELuJpWpjs+1a0z0 MLp5aCwHO8IheiJOmFsfhXhYIfY2BuiOqT5r9GofWj72pUf03lBbc3OFP9/Lmfjdir vZgvibF50EYKcbkwFzhUOG5LofVX7V2vtTO6jnrA= From: "anlauf at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/113793] malloc abort on character allocate with source argument Date: Wed, 07 Feb 2024 22:09:05 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: fortran X-Bugzilla-Version: unknown X-Bugzilla-Keywords: wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: anlauf at gcc dot gnu.org X-Bugzilla-Status: NEW 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: attachments.created Message-ID: In-Reply-To: References: 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 --- Comment #2 from anlauf at gcc dot gnu.org --- Created attachment 57354 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=3D57354&action=3Dedit Tentative partial patch This appears to fix the malloc size for character arrays, but not for allocatable scalars, like in: program p implicit none CHARACTER*30, allocatable :: a(:), b(:,:), d CHARACTER(kind=3D4,len=3D15),allocatable :: c(:), e ALLOCATE (a(100),source=3D" ") ! OK ALLOCATE (b(5,6),source=3D" ") ! OK ALLOCATE (c(42), source=3D4_"zzz") ! OK ALLOCATE (d,source=3D"xx") ! malloc too small ALLOCATE (e,source=3D4_"zz") ! malloc too small END=