This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Fix infinite recursion in C front end during bad struct parsing. (ping)
- From: Mark Mitchell <mark at codesourcery dot com>
- To: Carlos O'Donell <carlos at codesourcery dot com>
- Cc: gcc-patches at gcc dot gnu dot org, "Joseph S. Myers" <joseph at codesourcery dot com>, Nathan Sidwell <nathan at codesourcery dot com>, Richard Henderson <rth at redhat dot com>
- Date: Fri, 14 Apr 2006 19:59:13 -0700
- Subject: Re: [PATCH] Fix infinite recursion in C front end during bad struct parsing. (ping)
- References: <20060413161815.GA21359@lios>
Carlos O'Donell wrote:
> Ping?
>
> http://gcc.gnu.org/ml/gcc-patches/2006-04/msg00161.html
This is OK, but I think we can make it a bit tidier.
In particular, modify update_alignment_for_field so that it returns
immediately if TREE_TYPE (field) is error_mark_node. (In general, we
try to make routines robust in the face of error_mark_node, since it can
appear "anywhere".)
Then, you will not need this hunk:
else if (TREE_CODE (rli->t) != RECORD_TYPE)
{
- place_union_field (rli, field);
+ if (bad_type)
+ {
+ /* Place the field at the start of the union. */
+ DECL_FIELD_OFFSET (field) = size_zero_node;
+ DECL_FIELD_BIT_OFFSET (field) = bitsize_zero_node;
+ SET_DECL_OFFSET_ALIGN (field, BIGGEST_ALIGNMENT);
+ }
+ else
+ place_union_field (rli, field);
return;
}
because place_union_field will do the right thing. Then, you will also
not need the bad_type variable, because it will have only one use; you
can just check "TREE_TYPE (field) == error_mark_node" here:
+ else if (bad_type)
+ {
+ /* Place this field at the current allocation position, so we
+ maintain monotonicity. */
+ DECL_FIELD_OFFSET (field) = rli->offset;
+ DECL_FIELD_BIT_OFFSET (field) = rli->bitpos;
+ SET_DECL_OFFSET_ALIGN (field, rli->offset_align);
+ return;
+ }
Please make those changes, retest, and commit.
Thanks,
--
Mark Mitchell
CodeSourcery
mark@codesourcery.com
(650) 331-3385 x713