On Wed, Dec 12, 2012 at 8:58 PM, Jakub Jelinek <ja...@redhat.com> wrote: > Hi! > > Before http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=193595 > aka the big vec.h changes, nonlocalized_list parameter to remap_decls > used to be **, but the changes changed it to *. That is a problem, > because then there is no difference between the case where we don't > want to push anything to nonlocalized_list (caller passes NULL) and > calling it with BLOCK_NONLOCALIZED_VARS, which is empty. > That resulted in vec_safe_push not being called, because nonlocalized_list > test was false. > > Fixed thusly, bootstrapped/regtested on x86_64-linux and i686-linux, ok for > trunk?
Ok. Thanks, Richard. > 2012-12-12 Jakub Jelinek <ja...@redhat.com> > > PR debug/55665 > * tree-inline.c (remap_decls): Change nonlocalized_list > to pointer to pointer to vector from pointer to vector. > (remap_block): Pass address of BLOCK_NONLOCALIZED_VARS. > > * g++.dg/guality/pr55665.C: New test. > > --- gcc/tree-inline.c.jj 2012-11-19 14:41:26.000000000 +0100 > +++ gcc/tree-inline.c 2012-12-12 18:23:31.937008538 +0100 > @@ -536,7 +536,7 @@ can_be_nonlocal (tree decl, copy_body_da > } > > static tree > -remap_decls (tree decls, vec<tree, va_gc> *nonlocalized_list, > +remap_decls (tree decls, vec<tree, va_gc> **nonlocalized_list, > copy_body_data *id) > { > tree old_var; > @@ -557,7 +557,7 @@ remap_decls (tree decls, vec<tree, va_gc > if ((!optimize || debug_info_level > DINFO_LEVEL_TERSE) > && !DECL_IGNORED_P (old_var) > && nonlocalized_list) > - vec_safe_push (nonlocalized_list, old_var); > + vec_safe_push (*nonlocalized_list, old_var); > continue; > } > > @@ -575,7 +575,7 @@ remap_decls (tree decls, vec<tree, va_gc > if ((!optimize || debug_info_level > DINFO_LEVEL_TERSE) > && !DECL_IGNORED_P (old_var) > && nonlocalized_list) > - vec_safe_push (nonlocalized_list, old_var); > + vec_safe_push (*nonlocalized_list, old_var); > } > else > { > @@ -622,7 +622,7 @@ remap_block (tree *block, copy_body_data > > /* Remap its variables. */ > BLOCK_VARS (new_block) = remap_decls (BLOCK_VARS (old_block), > - BLOCK_NONLOCALIZED_VARS (new_block), > + &BLOCK_NONLOCALIZED_VARS (new_block), > id); > > if (id->transform_lang_insert_block) > --- gcc/testsuite/g++.dg/guality/pr55665.C.jj 2012-12-12 18:37:11.829241332 > +0100 > +++ gcc/testsuite/g++.dg/guality/pr55665.C 2012-12-12 18:34:59.000000000 > +0100 > @@ -0,0 +1,33 @@ > +// PR debug/55655 > +// { dg-do run } > +// { dg-options "-g" } > + > +extern "C" void abort (); > +struct A { A (int); int a; }; > + > +__attribute__((noinline, noclone)) int > +bar (void) > +{ > + return 40; > +} > + > +__attribute__((noinline, noclone)) void > +foo (int x) > +{ > + __asm volatile ("" : : "r" (x) : "memory"); > +} > + > +A::A (int x) > +{ > + static int p = bar (); > + foo (p); // { dg-final { gdb-test 23 "p" "40" } } > + a = ++p; > +} > + > +int > +main () > +{ > + A a (42); > + if (a.a != 41) > + abort (); > +} > > Jakub