This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] Fix C++ bootstrap ICE
- From: Mark Kettenis <mark dot kettenis at xs4all dot nl>
- To: gcc-patches at gcc dot gnu dot org, jason at redhat dot com
- Date: Fri, 7 Sep 2012 18:11:04 +0200 (CEST)
- Subject: [PATCH] Fix C++ bootstrap ICE
The following change (r190962):
2012-09-04 Jason Merrill <jason@redhat.com>
PR c++/54441
* decl.c (reshape_init_class): Handle invalid initializer for
0-length array member.
introduces a poinential dereference of d->end. I hit this when
bootstrapping on OpenBSD/i386. Looks Like this change didn't take
into account that reshape_init_r() might move d->cur past the end of
the list of fields. Potential fix below. Simply reordering the
checks in the if-statement avoids the problem.
gcc/cp:
2012-09-07 Mark Kettenis <kettenis@openbsd.org>
* decl.c (reshape_init_class): Avoid dereferencing a
past-the-end pointer.
Index: decl.c
===================================================================
--- decl.c (revision 191075)
+++ decl.c (working copy)
@@ -5131,7 +5131,7 @@
if (field_init == error_mark_node)
return error_mark_node;
- if (d->cur->index && d->cur == old_cur)
+ if (d->cur == old_cur && d->cur->index)
{
/* This can happen with an invalid initializer for a flexible
array member (c++/54441). */