MantisBT - GCC-XML
View Issue Details
0010440GCC-XMLpublic2010-03-18 13:162015-03-26 11:59
Jakub Zytka 
Brad King 
normalmajoralways
resolvedsuspended 
0010440: internal compiler error: in write_type, at cp/mangle.c:1649
latest cvs gccxml

example code:
struct Foo {};
struct FooContainer;
FooContainer* getContainer(Foo *);

template <typename T>
struct SelfType
{
        typedef T Type;
};

template<typename T>
void f(T e)
{
typedef typename SelfType<typeof(*getContainer(static_cast<T*>(0)))>::Type Container;
}

gccxmls returns:
internal compiler error: in write_type, at cp/mangle.c:1649

invalid xml is produced (see attachment)
No tags attached.
xml 1.xml (412,047) 2010-03-18 13:16
https://public.kitware.com/Bug/file/2982/1.xml
diff 405.diff (644) 2010-03-19 09:24
https://public.kitware.com/Bug/file/2985/405.diff
Issue History
2010-03-18 13:16Jakub ZytkaNew Issue
2010-03-18 13:16Jakub ZytkaFile Added: 1.xml
2010-03-19 08:49Brad KingStatusnew => assigned
2010-03-19 08:49Brad KingAssigned To => Brad King
2010-03-19 08:50Brad KingNote Added: 0019963
2010-03-19 09:24Jakub ZytkaFile Added: 405.diff
2010-03-19 09:26Jakub ZytkaNote Added: 0019964
2010-06-10 12:56Brad KingNote Added: 0020971
2010-06-10 12:59Brad KingNote Added: 0020972
2015-03-26 11:59Brad KingNote Added: 0038326
2015-03-26 11:59Brad KingStatusassigned => resolved
2015-03-26 11:59Brad KingResolutionopen => suspended

Notes
(0019963)
Brad King   
2010-03-19 08:50   
Can you please attach the patch you mentioned on the mailing list? Thanks!
(0019964)
Jakub Zytka   
2010-03-19 09:26   
Diff attached. This is very lousy patch though, i just wanted to see what happens. I don't have broad knowledge regarding gcc.
(0020971)
Brad King   
2010-06-10 12:56   
I had a couple minutes to look at this today; here is an update.

The ICE occurs while printing the "mangle=" attribute here:

<Struct id="_108" name="SelfType<__typeof__ (* getContainer(static_cast<T*>(0)))>" context="_1" incomplete="1"

While your patch addresses the symptom, the real problem is that gccxml is trying to dump part of an uninstantiated template. It's a pseudo-instantiation that gcc seems to use for some bookkeeping and should never be dumped. Normally such types are rejected by xml_find_template_parm. However, in this case it's reaching TYPEOF_TYPE but the nested expression (reported by TYPEOF_TYPE_EXPR) is NULL.
(0020972)
Brad King   
2010-06-10 12:59   
More precisely, the TYPEOF_TYPE's expression is of type INDIRECT_REF whose TREE_TYPE is NULL.
(0038326)
Brad King   
2015-03-26 11:59   
As announced here:

 [ANNOUNCE] GCC-XML maintenance moving to Github
 http://thread.gmane.org/gmane.comp.compilers.gccxml/731 [^]
 http://public.kitware.com/pipermail/gccxml/2015-March/003206.html [^]

gccxml will no longer be developed by its original author, who will instead focus on CastXML:

 https://github.com/CastXML/CastXML#readme [^]

The original GCC-XML issue tracker is now closed. In order to facilitate ongoing maintenance by community participants, issues will now be tracked on the Github repository page:

 https://github.com/gccxml/gccxml/issues [^]