From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 698783856DC5; Thu, 14 Jul 2022 15:35:19 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 698783856DC5 From: "dmalcolm at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug analyzer/106302] New: RFE: provide a way for -fanalyzer to use target flags Date: Thu, 14 Jul 2022 15:35:19 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: analyzer X-Bugzilla-Version: 12.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: dmalcolm at gcc dot gnu.org X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: dmalcolm at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter blocked target_milestone Message-ID: 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, 14 Jul 2022 15:35:19 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D106302 Bug ID: 106302 Summary: RFE: provide a way for -fanalyzer to use target flags Product: gcc Version: 12.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: analyzer Assignee: dmalcolm at gcc dot gnu.org Reporter: dmalcolm at gcc dot gnu.org Blocks: 106003, 106301 Target Milestone: --- As noted in the discussion here: https://gcc.gnu.org/pipermail/gcc/2022-June/238954.html -fanalyzer sometimes uses specific target flags when modeling the behavior = of functions, see e.g.: sm-fd.cc, which currently has: enum access_mode fd_state_machine::get_access_mode_from_flag (int flag) const { /* FIXME: this code assumes the access modes on the host and target are the same, which in practice might not be the case. */ if ((flag & O_ACCMODE) =3D=3D O_RDONLY) { return READ_ONLY; } else if ((flag & O_ACCMODE) =3D=3D O_WRONLY) { return WRITE_ONLY; } return READ_WRITE; } where we are using the values of O_ACCMODE, O_RDONLY, and O_WRONLY from the host's headers, rather than those of the target. See also bug 106301, where properly supporting mmap would mean looking at values of MAP_ANONYMOUS, and of the various PROT_ values. Joseph suggested adding a target hook for this, though I think we'd need an enum for it, so that we can add various different "well known" values that = we'd want to query for on the host. Alternatively, perhaps we could directly qu= ery the preprocessor somehow, though that wouldn't work for the LTO case. Referenced Bugs: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D106003 [Bug 106003] RFE: -fanalyzer could complain about misuse of file-descriptors https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D106301 [Bug 106301] RFE: analyzer support of mmap=