From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id EC0E83858D37; Thu, 6 Oct 2022 18:02:21 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org EC0E83858D37 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1665079341; bh=vKKep1Kss9wdcU3TInPio0seoARMDvRY6TNahkJYsNo=; h=From:To:Subject:Date:In-Reply-To:References:From; b=Mcjg8F7C4f+y25ceJFQGJMykt5KSjqxQ/GJ0HQr4VGNm/2i/pwTZP1exsszWW0oH1 aOpUL4O3X8HfY8Xq/XQpdNApyQpVosevn3VSvbEkn/GoOUjRo2WvjDgrIBrrtBXSlT rEN+q3TbB3bc1KwF66q/v4Ff7H3+X7bjkLGb9qs4= From: "anlauf at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/107075] ICE in get, at cgraph.h:461 Date: Thu, 06 Oct 2022 18:02:21 +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: 13.0 X-Bugzilla-Keywords: ice-on-valid-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=3D107075 --- Comment #5 from anlauf at gcc dot gnu.org --- There is a check in expr.cc:2623 that is reached if one changes the testcase to a subroutine, but not if it is a program: 4615 if (!attr.save && rvalue->expr_type =3D=3D EXPR_VARIABLE 4616 && rvalue->symtree->n.sym->ns->proc_name 4617 && rvalue->symtree->n.sym->ns->proc_name->attr.is_main_program) 4618 { 4619 rvalue->symtree->n.sym->ns->proc_name->attr.save =3D SAVE_IMPLICIT; 4620 attr.save =3D SAVE_IMPLICIT; 4621 } 4622 4623 if (!attr.save) 4624 { 4625 gfc_error ("Pointer initialization target at %L " 4626 "must have the SAVE attribute", &rvalue->where= ); 4627 return false; 4628 } I think the first check tries to fake that the target has the right attributes in a main program (implicit save) while it hasn't. If we fix the attributes of variables in the main program, the above check should be revisited.=