Fix latent bug in c++ frontend

Jason Merrill jason@redhat.com
Wed Jan 22 22:44:00 GMT 2003


On Thu, 16 Jan 2003 19:17:46 +0100, Josef Zlomek <zlomj9am@artax.karlin.mff.cuni.cz> wrote:

> this patch probably fixes a bug in C++ frontend which caused segfault.
> It appeared when compiling gtkmm, I have destiled attached testcase from it.
>
> I am not familiar with C++ frontend code so the patch may be wrong,
> can someone who understand C++ frontend check it?
>
>
> template <class T>
> inline T* manage(T* t)
>   {
>    return t;
>   }
>
> template <class R>
> struct ObjectSlot0_
>   {
>    static void create()
>      {
>       manage(new int);
>      }
>   };
>
> The problem is with "new anytype" in a templated function call. 
> The attached patch fixes the segfault.
>
>
> When I changed "new int" to "new int[4]" I got:
> xx.i:12: internal compiler error: tree check: expected class 't', 
>    have 'x' (tree_list) in cp_parser_dependent_type_p, at cp/parser.c:1859
>
> I do not know how to fix it, but such a construction is probably not
> used in majority of software packages.

Try checking TREE_TYPE (TREE_TYPE (n)) instead.

Jason



More information about the Gcc-patches mailing list