From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 139083858C2C; Mon, 29 Aug 2022 18:49:31 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 139083858C2C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1661798971; bh=y1YgnnMC5e6AsIZ+5z3UtBSN/kiEMCwmtpLSLOe/7VE=; h=From:To:Subject:Date:In-Reply-To:References:From; b=yxvCoDIUg84XPjU/48jPz5HByzA5zPrJMyR2mLI3OuBvyOW7VFyi7mUP31PryBSPa DCBKNKcK5NiDt6WUsmiA/oNPRAqxnc2m1TvPIR1B6iCZm2o4Wbi67+RXJSIN9XEmmU RHhLZCLz6PBSt8KL8lFL2z3bS9Bvq9Dd2qURa4ak= From: "anlauf at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/106771] [OOP] ICE with PACK intrinsic, in gfc_conv_expr_descriptor, at fortran/trans-array.c:7328 Date: Mon, 29 Aug 2022 18:49:30 +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: 9.2.0 X-Bugzilla-Keywords: ice-on-valid-code X-Bugzilla-Severity: normal X-Bugzilla-Who: anlauf at gcc dot gnu.org X-Bugzilla-Status: WAITING 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=3D106771 --- Comment #4 from anlauf at gcc dot gnu.org --- (In reply to federico from comment #3) > Right: here is a version where the object is initialized:=20 >=20 > https://godbolt.org/z/o566cPG8P >=20 > I also see that for the versions that compile (e.g., 11.1.0), there's a > weird SEGFAULT error at this line:=20 >=20 >=20 > elemental logical function isa(this,i) > class(t), intent(in) :: this > integer, intent(in) :: i > integer :: n > n =3D merge(size(this%iloc),0,allocated(this%iloc)) > if (i>0 .and. i<=3Dn) then ! Segmentation fault here=20 > isa =3D this%iloc(i)>0 > else > isa =3D .false. > endif=20=20 > end function isa >=20 > So it at least compiles, but apparently the bug is hidden somewhere else? Well, the following might be the reason for failure: ilocs =3D pack(this%iloc(IDs),this%is_active(ilocs)) Here ilocs is not allocated, it is the function result. Also Intel does not like it. Replacing these lines with ilocs =3D pack(this%iloc(IDs),this%is_active(IDs)) makes the code run successfully for gcc versions listed under "known to wor= k". User error?=