From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id D720B384D6F9; Wed, 14 Dec 2022 20:28:08 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D720B384D6F9 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1671049688; bh=PK9TO2NoFxEVt2dhuv31Wutt6bIoFDWZY+fChECPVKw=; h=From:To:Subject:Date:In-Reply-To:References:From; b=G5A7sPJpwmPjnhToTtmX2yIV01Sm9KrfX3gCdLCEqIT5TsHx+S/cTyOrV3sdO3waM t9OyaBFECnUCqTydBZkFyyivdHol6aKVZhdKGSxUAKcPa2VNW50VHGs132QqQYMeUB 8nBGf7PemIh+FY/KaKTI9+8DUfKRd3MoaDwPoEOg= From: "anlauf at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/95947] PACK intrinsic returns blank strings when an allocatable character array with allocatable length is used Date: Wed, 14 Dec 2022 20:28:08 +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: 8.3.1 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: 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=3D95947 --- Comment #5 from anlauf at gcc dot gnu.org --- The dump tree shows near the pack intrinsic: - for character(len=3D10): atmp.4.dtype =3D {.elem_len=3D10, .rank=3D1, .type=3D6}; atmp.4.span =3D 10; atmp.4.data =3D 0B; atmp.4.offset =3D 0; _gfortran_pack_char (&atmp.4, 10, D.4308, D.4328, 0B, 10, 0); - for character(len=3D:): atmp.5.dtype =3D {.elem_len=3D(unsigned long) slen.4, .rank=3D1, .type= =3D6}; atmp.5.span =3D (integer(kind=3D8)) SAVE_EXPR <(sizetype) NON_LVALUE_EX= PR >; atmp.5.data =3D 0B; atmp.5.offset =3D 0; slen.4 =3D 0; _gfortran_pack_char (&atmp.5, &slen.4, D.4314, D.4334, 0B, .n, 0); So we seem to clobber the string length before calling pack.=