https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97614

            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.
  • [Bug analyzer/9761... brechtsanders at users dot sourceforge.net via Gcc-bugs

Reply via email to