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

David Malcolm <dmalcolm at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2021-02-10
             Status|UNCONFIRMED                 |ASSIGNED
     Ever confirmed|0                           |1

--- Comment #18 from David Malcolm <dmalcolm at gcc dot gnu.org> ---
(In reply to qinzhao from comment #17)
> (In reply to David Malcolm from comment #15)

> > /builddir/build/BUILD/wine-gecko-2.47.1/wine-gecko-2.47.1-x86/widget/windows/
> > Unified_cpp_widget_windows0.cpp:2:
> > /usr/i686-w64-mingw32/sys-root/mingw/include/cfgmgr32.h: At global scope:
> > /usr/i686-w64-mingw32/sys-root/mingw/include/cfgmgr32.h:19: note: loc_a
> >    19 |   typedef CONST VOID *PCVOID;
> 
> Is the above line the failing point for the testing file?
> 
> there is a "CONST" qualifier. I am not sure whether it's helpful or not: we
> found that deleting "CONST" from the source code helped the compilation to
> succeed.

Yes.

Note how there are no column numbers for the macro invocation locations.

The issue occurs when location_t > LINE_MAP_MAX_LOCATION_WITH_COLS (enough
source has been compiled that we've stopped tracking column numbers).

We have two locations that are both from macro expansions, and return the same
output from:
  linemap_resolve_location (set, [...], LRK_MACRO_EXPANSION_POINT, NULL);
i.e. line 19 of cfgmgr32.h

cc1plus attempts to compare the locations of the two declarators ("const" and
"void"), decides that they are the same location, and assumes they must be from
the  same macro expansion - but they're only at the same location because we're
no longer attempting to track column numbers.

Converting one of both of those "const" and "void" to non-macros ought to work
around it.

I've created a minimal reproducer and will attempt a fix.

Reply via email to