This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] Fix PR23576, ICE on invalid
- From: Richard Guenther <rguenther at suse dot de>
- To: gcc-patches at gcc dot gnu dot org
- Date: Mon, 29 Aug 2005 13:19:03 +0200 (CEST)
- Subject: [PATCH] Fix PR23576, ICE on invalid
This fixes the ICE in PR23576 by not writing into a type which
is error_mark_node.
Bootstrapped and regtested on x86_64-unknown-linux-gnu.
Ok for mainline and 4.0?
Thanks,
Richard.
:ADDPATCH middle-end:
2005-08-29 Richard Guenther <rguenther@suse.de>
* c-decl.c (grokdeclarator): Don't write to fields
of error_mark_node.
* gcc.dg/noncompile/pr23576.c: New testcase.
Index: c-decl.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/c-decl.c,v
retrieving revision 1.682
diff -c -3 -p -r1.682 c-decl.c
*** c-decl.c 18 Aug 2005 00:21:28 -0000 1.682
--- c-decl.c 29 Aug 2005 09:35:28 -0000
*************** grokdeclarator (const struct c_declarato
*** 4247,4262 ****
else
type = build_array_type (type, itype);
! if (size_varies)
! C_TYPE_VARIABLE_SIZE (type) = 1;
!
! /* The GCC extension for zero-length arrays differs from
! ISO flexible array members in that sizeof yields
! zero. */
! if (size && integer_zerop (size))
{
! TYPE_SIZE (type) = bitsize_zero_node;
! TYPE_SIZE_UNIT (type) = size_zero_node;
}
if (decl_context != PARM
--- 4247,4265 ----
else
type = build_array_type (type, itype);
! if (type != error_mark_node)
{
! if (size_varies)
! C_TYPE_VARIABLE_SIZE (type) = 1;
!
! /* The GCC extension for zero-length arrays differs from
! ISO flexible array members in that sizeof yields
! zero. */
! if (size && integer_zerop (size))
! {
! TYPE_SIZE (type) = bitsize_zero_node;
! TYPE_SIZE_UNIT (type) = size_zero_node;
! }
}
if (decl_context != PARM
struct ipr_path_entry path[0]; /* { dg-error "array type has incomplete element type" } */