From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 8D2F2385801A; Wed, 28 Oct 2020 09:56:01 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 8D2F2385801A From: "brechtsanders at users dot sourceforge.net" To: gcc-bugs@gcc.gnu.org Subject: [Bug analyzer/97614] New: MinGW-w64 pointer to long conversion loses precision error Date: Wed, 28 Oct 2020 09:56:01 +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: 11.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: brechtsanders at users dot sourceforge.net 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 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: Wed, 28 Oct 2020 09:56:01 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D97614 Bug ID: 97614 Summary: MinGW-w64 pointer to long conversion loses precision error Product: gcc Version: 11.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: analyzer Assignee: dmalcolm at gcc dot gnu.org Reporter: brechtsanders at users dot sourceforge.net Target Milestone: --- When compiling GCC 11-20201025 with MinGW-w64 I got the following error: ../../gcc/analyzer/store.h: In member function 'hashval_t ana::symbolic_binding::hash() const': ../../gcc/analyzer/store.h:272:41: error: cast from 'const ana::region*' to 'long int' loses precision [-fpermissive] 272 | return (binding_key::impl_hash () ^ (long)m_region); | ^~~~~~~~~~~~~~ This is typically caused by the false assumption that pointer and long have= the same size, which is not true on Windows/MinGW. Usually the solution is to cast to something like intptr_t instead of long.=