This is the mail archive of the
mailing list for the GCC project.
Re: Query about the TREE_TYPE field
- From: Andrew MacLeod <amacleod at redhat dot com>
- To: Jason Merrill <jason at redhat dot com>, GCC <gcc at gcc dot gnu dot org>
- Cc: Richard Biener <richard dot guenther at gmail dot com>
- Date: Tue, 18 Nov 2014 09:52:27 -0500
- Subject: Re: Query about the TREE_TYPE field
- Authentication-results: sourceware.org; auth=none
- References: <546B572F dot 7070103 at redhat dot com> <546B5A64 dot 3080807 at redhat dot com>
On 11/18/2014 09:40 AM, Jason Merrill wrote:
Indeed. The condition is negated, so effectively it becomes an
always true condition and the ATTR_FLAG_TYPE_IN_PLACE is always turned
off when a DECL is passed and a type is required..
On 11/18/2014 09:26 AM, Andrew MacLeod wrote:
I was poking around attribs.c while trial running my tree-type-safety
stuff, and it triggered something in decl_attributes() that seems fishy
to me. It looks like it was part of the fix for
decl_attributes() can be passed a tree node which is either decl or a
type, but we get to this little snippet:
if (spec->type_required && DECL_P (*anode))
anode = &TREE_TYPE (*anode);
/* Allow ATTR_FLAG_TYPE_IN_PLACE for the type's naming
if (!(TREE_CODE (*anode) == TYPE_DECL
&& *anode == TYPE_NAME (TYPE_MAIN_VARIANT
flags &= ~(int) ATTR_FLAG_TYPE_IN_PLACE;
anode is changed to point to the TREE_TYPE of the original decl, and
*then* checks if it is a TYPE_DECL... That doesnt seem right to me..
we can't have a TYPE_DECL as a TREE_TYPE can we?
is that code suppose to be checking is the original DECL is a TYPE_DECL
rather than the TREE_TYPE?
I think so.
Maybe the assignment to anode should be after the if instead of in front
Strange that the 35315 patch fixed the testcase with that change being
maybe that works most/all of the time? huh, that also means the code
is the same as it was before the patch :-P
maybe one of the follow up patches in bugzilla supercede it?