This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [C++ PATCH] for PR72457


On 2016.07.27 at 17:21 -0400, Jason Merrill wrote:
> On Wed, Jul 27, 2016 at 2:50 AM, Markus Trippelsdorf
> <markus@trippelsdorf.de> wrote:
> > On 2016.07.23 at 22:55 -0400, Jason Merrill wrote:
> >> Using build_value_init in a base initialization is wrong, because it
> >> calls the complete object constructor and misses protected access.  So
> >> let's handle list-value-initialization in expand_aggr_init_1.
> >>
> >> Tested x86_64-pc-linux-gnu, applying to trunk.
> >
> > This patch causes https://gcc.gnu.org/bugzilla/show_bug.cgi?id=72457.
> > And because it was backported, the gcc-6 branch is also affected.
> >
> > The following fix was tested on ppc64le. OK for trunk and gcc-6?
> >
> > (Unfortunately the reduced testcase is much too big.)
> >
> >          PR c++/72457
> >          *constexpr.c (cx_check_missing_mem_inits): Handle potential
> >          NULL_TREE.
> >
> > diff --git a/gcc/cp/constexpr.c b/gcc/cp/constexpr.c
> > index 6bcb41ae8254..83fd9a4896ac 100644
> > --- a/gcc/cp/constexpr.c
> > +++ b/gcc/cp/constexpr.c
> > @@ -734,7 +734,7 @@ cx_check_missing_mem_inits (tree fun, tree body, bool complain)
> >               || DECL_ARTIFICIAL (index))
> >             continue;
> >         }
> > -      for (; field != index; field = DECL_CHAIN (field))
> > +      for (; field != NULL_TREE && field != index; field = DECL_CHAIN (field))
> 
> This is wrong; it ends up just skipping over the rest of the fields,
> so we don't check whether they were initialized.  Rather, we need to
> handle seeing two initializers in a row for the same field.

OK. I will let you handle this issue.

It would be good to have a testcase that fails when the rest of the
fields are skipped over.

-- 
Markus


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]