From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 4AE353844019; Thu, 18 Mar 2021 20:16:29 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 4AE353844019 From: "burnus at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/99651] Cannot change attributes of USE-associated intrinsic Date: Thu, 18 Mar 2021 20:16:29 +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: 10.2.0 X-Bugzilla-Keywords: rejects-valid X-Bugzilla-Severity: normal X-Bugzilla-Who: burnus 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: cf_reconfirmed_on bug_status everconfirmed 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 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Mar 2021 20:16:29 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D99651 Tobias Burnus changed: What |Removed |Added ---------------------------------------------------------------------------- Last reconfirmed| |2021-03-18 Status|UNCONFIRMED |NEW Ever confirmed|0 |1 --- Comment #2 from Tobias Burnus --- That's for matching 'NULL()' in: CHAR_STAR_NULL =3D CHAR_STAR(NULL()) The problem is that during matching we end up in gfc_match_rvalue for: /* Give up, assume we have a function. */ e->expr_type =3D EXPR_FUNCTION; if (!sym->attr.function && !gfc_add_function (&sym->attr, sym->name, NULL)) which then also set: if (attr->flavor !=3D FL_PROCEDURE && !gfc_add_flavor (attr, FL_PROCEDURE, name, where)) return false; attr->function =3D 1 And later then: resolve_function =E2=86=92 resolve_unknown_f =E2=86=92 gfc_intrinsic_func= _interface the latter than has: if (sym->attr.flavor =3D=3D FL_UNKNOWN) { sym->attr.function =3D 1; sym->attr.intrinsic =3D 1; sym->attr.flavor =3D FL_PROCEDURE; } Thus, at the end intrinsic is not set in the module. For the next use, we run into the following in gfc_match_null: if (sym->attr.proc !=3D PROC_INTRINSIC && !(sym->attr.use_assoc && sym->attr.intrinsic) && (!gfc_add_procedure(&sym->attr, PROC_INTRINSIC, sym->name, NULL) || !gfc_add_function (&sym->attr, sym->name, NULL))) return MATCH_ERROR; Here, we have: - PROC_UNKNOWN - sym->attr.intrinsic =3D=3D 0 - gfc_add_procedure =E2=86=92 this calls 'check_used' =E2=86=92 which fails due to attr->use_= assoc !=3D 0.=