This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Why is the TREE_PURPOSE of a CONSTRUCTOR_ELT list forARRAY_TYPE NULL?
- From: Daniel Berlin <dberlin at dberlin dot org>
- To: Richard Kenner <kenner at vlsi1 dot ultra dot nyu dot edu>
- Cc: giovannibajo at libero dot it, gcc-patches at gcc dot gnu dot org
- Date: Mon, 06 Sep 2004 21:37:12 -0400
- Subject: Re: Why is the TREE_PURPOSE of a CONSTRUCTOR_ELT list forARRAY_TYPE NULL?
- References: <10409070119.AA21979@vlsi1.ultra.nyu.edu>
On Mon, 2004-09-06 at 21:19 -0400, Richard Kenner wrote:
> Then a sanity check should really be added somewhere, when the FE is
> fixed. During gimplification maybe?
>
> There is one, in gimplify_init_ctor_eval:
>
> /* ??? Here's to hoping the front end fills in all of the indicies,
> so we don't have to figure out what's missing ourselves. */
> if (!purpose)
> abort ();
>
> I don't know why it wasn't triggered in this case.
The thing in question was a readonly static.
Maybe this is why (I thought we kept DECL_INITIAL for those, instead of
gimplifying it)? I'm just taking a shot in the dark
The testcase is actually rather short.
I've pasted it below, and i'll file a bug report with it.
(gdb) p debug_tree (decl)
<var_decl 0x40139414 _ZTVSt9exception
type <array_type 0x401396cc
....
(gdb) p debug_tree (decl.decl.initial)
<constructor 0x4005bb80
arg 0 <tree_list 0x401383c0
value <nop_expr 0x4005bac0 type <pointer_type 0x400cec3c
__vtbl_ptr_type>
constant invariant
arg 0 <integer_cst 0x40138348 constant invariant 0>>
chain <tree_list 0x401383a8
value <nop_expr 0x4005baa0 type <pointer_type 0x400cec3c
__vtbl_ptr_type>
readonly constant invariant
....
(note the lack of purpose trees)
simple testcase:
extern "C++"
{
namespace std
{
class exception
{
public:exception () throw ()
{
} virtual ~ exception () throw ();
virtual const char *what () const throw ();
};
}
namespace __cxxabiv1
{
}
namespace std
{
class bad_cast:public exception
{
public:bad_cast () throw ()
{
} virtual ~ bad_cast () throw ();
};
}
}
namespace __cxxabiv1
{
extern "C" void __cxa_bad_cast ();
}
extern "C" void
__cxxabiv1::__cxa_bad_cast ()
{
throw std::bad_cast ();
}