From 1af980453827d996e94e360fc137331a0dccb828 Mon Sep 17 00:00:00 2001 From: gerald Date: Sun, 9 Sep 2012 10:06:13 +0000 Subject: [PATCH] * decl.c (reshape_init_class): Avoid dereferencing a past-the-end pointer. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@191106 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/cp/ChangeLog | 5 +++++ gcc/cp/decl.c | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 0fea1a6..371fdfe 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,8 @@ +2012-09-09 Mark Kettenis + + * decl.c (reshape_init_class): Avoid dereferencing a + past-the-end pointer. + 2012-09-07 Paolo Carlini * pt.c (num_template_headers_for_class): Rework per the code diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index f86c54f..7655f78 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -5131,7 +5131,7 @@ reshape_init_class (tree type, reshape_iter *d, bool first_initializer_p, 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). */ -- 2.7.4