This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Maybe fix PR87134
On Wed, 5 Sep 2018, Richard Biener wrote:
> On Wed, 5 Sep 2018, Jakub Jelinek wrote:
>
> > On Wed, Sep 05, 2018 at 12:55:55PM +0200, Richard Biener wrote:
> > >
> > > The following makes sure to call the default CTOR when emplacing a
> > > vec<> in the avail hash-map. Certainly the intent was to zero-initialize
> > > the m_vec member.
> >
> > Guess it would be nice to see what older versions of system g++ do with
> > that.
> > At least from what I remember last time, value-initialization vs.
> > zero-initialization vs. no initialization in C++ is heavily dependent on
> > compiler version and -std=c++NN version, there have been many bugs in the
> > past and changes between standard versions.
>
> It looks like g++ 4.8 puts extra zero-init with () but not without:
>
> - (void) (struct vec *) operator new (8, (void *) TARGET_EXPR <D.107094,
> (struct vec *) av>) >>>>>;
> + (void) (TARGET_EXPR <D.107096, (void *) TARGET_EXPR <D.107094, (struct
> vec *) av>>;, TARGET_EXPR <D.107095, operator new (8, NON_LVALUE_EXPR
> <D.107096>)>;;, (struct vec *) D.107095 != 0B ? *(struct vec *) D.107095 =
> {.m_vec=0B};, (struct vec *) D.107095; : (struct vec *) D.107095;) >>>>>;
So I'm testing the following then, leaving the placement new untouched
(no init is fine) and then assign from vNULL.
2018-09-05 Richard Biener <rguenther@suse.de>
PR bootstrap/87134
* tree-ssa-sccvn.c (rpo_elim::eliminate_push_avail): Make sure
to zero-init the emplaced vec.
Index: gcc/tree-ssa-sccvn.c
===================================================================
--- gcc/tree-ssa-sccvn.c (revision 264123)
+++ gcc/tree-ssa-sccvn.c (working copy)
@@ -5799,6 +5799,7 @@ rpo_elim::eliminate_push_avail (basic_bl
if (!existed)
{
new (&av) vec<std::pair<int, int> >;
+ av = vNULL;
av.reserve_exact (2);
}
av.safe_push (std::make_pair (bb->index, SSA_NAME_VERSION (leader)));