From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 050CC3858D20; Thu, 13 Apr 2023 19:59:02 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 050CC3858D20 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1681415943; bh=aJbmHB+eygTc7tU8IuKiRv5Xgi7DLvX1C4UMkCtTb2Y=; h=From:To:Subject:Date:In-Reply-To:References:From; b=ImFxLav2vSgz3zA2KE73m5JTbLcoArpwVzKQh57bpzFSNCJwF2xiJMevvPPcxdJby OmhN/aivtUh1LX4x7n6uLlshpHs/jJJTFxG6aPclby0OzLz06kGbU8zioXAtuOR3NH cqEwWRBqNK4Zf+lmM7wTyRJkhz3Yzl6OmmDHC8d4= From: "aldot at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/103931] Type name "c_ptr" is ambiguous when iso_c_binding is imported both directly and indirectly Date: Thu, 13 Apr 2023 19:59:02 +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.1 X-Bugzilla-Keywords: rejects-valid X-Bugzilla-Severity: normal X-Bugzilla-Who: aldot 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=3D103931 --- Comment #15 from Bernhard Reutner-Fischer --- (In reply to Bernhard Reutner-Fischer from comment #13) > I'm testing a patch. I have to admit that this is a mess. It's even more frustrating now as i did some preparatory cleanup for at lea= st some of the inconveniences in that area a while ago but never got to apply these. Anyway. Not sure if the following would be correct: Under the assumption that we have a generic "c_ptr" in a module, we know (?) that "c_ptr" is not ambiguous. Is that right? >From what i see from a quick glance, we seem to write more symbols to the module files than strictly needed, and that does not really help the case. Short of a broader fix, a quick-hack to avoid the error about ambiguous intrinsic built-in symbols might be to (*cough*): --- a/gcc/fortran/module.cc +++ b/gcc/fortran/module.cc @@ -5320,6 +5322,11 @@ check_for_ambiguous (gfc_symtree *st, pointer_info *info) return false; } + /* A symbol from an intrinsic module is not ambiguous. */ + /* This should not be necessary, at least not in this form! */ + if (st_sym->from_intmod !=3D INTMOD_NONE) + return false; + return true; } This works as expected, fixes this specific PR and tests cleanly. Should i propose this workaround as a patch or is it a bit too gross? WDYT?=