This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Fix latent bug in c++ frontend
- From: Jason Merrill <jason at redhat dot com>
- To: Josef Zlomek <zlomj9am at artax dot karlin dot mff dot cuni dot cz>
- Cc: gcc-patches at gcc dot gnu dot org, gcc at gcc dot gnu dot org
- Date: Mon, 20 Jan 2003 19:18:13 -0500
- Subject: Re: Fix latent bug in c++ frontend
- References: <20030116181745.GA17380@artax.karlin.mff.cuni.cz>
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