Message ID | 20150330113121.GA52842@msticlxl57.ims.intel.com |
---|---|
State | New |
Headers | show |
> On 30 Mar 14:05, Ilya Enkovich wrote: > > 2015-03-27 18:23 GMT+03:00 Jan Hubicka <hubicka@ucw.cz>: > > > Index: symtab.c > > > =================================================================== > > > --- symtab.c (revision 221734) > > > +++ symtab.c (working copy) > > > @@ -1130,15 +1130,20 @@ symtab_node::verify_symtab_nodes (void) > > > &existed); > > > if (!existed) > > > *entry = node; > > > - else > > > - for (s = (*entry)->same_comdat_group; s != NULL && s != node; s = s->same_comdat_group) > > > + else if (!DECL_EXTERNAL (node->decl)) > > > + { > > > + for (s = (*entry)->same_comdat_group; s != NULL && s != node; > > > + s = s->same_comdat_group) > > > + ; > > > > With no if-statement in the loop body you need an additional exit > > condition for a case when you reach the entry. > > > > Thanks, > > Ilya > > > > Here is a patch to add a testcase, fix the loop and avoid same_comdat_group for instrumented external symbols. Does it look OK? OK > > BTW should we check same_comdat_group is NULL for external symbols? We could do that, yes. If you can come with a patch, it is OK for next stage1. Honza
2015-03-30 20:20 GMT+03:00 Jan Hubicka <hubicka@ucw.cz>: >> On 30 Mar 14:05, Ilya Enkovich wrote: >> > 2015-03-27 18:23 GMT+03:00 Jan Hubicka <hubicka@ucw.cz>: >> > > Index: symtab.c >> > > =================================================================== >> > > --- symtab.c (revision 221734) >> > > +++ symtab.c (working copy) >> > > @@ -1130,15 +1130,20 @@ symtab_node::verify_symtab_nodes (void) >> > > &existed); >> > > if (!existed) >> > > *entry = node; >> > > - else >> > > - for (s = (*entry)->same_comdat_group; s != NULL && s != node; s = s->same_comdat_group) >> > > + else if (!DECL_EXTERNAL (node->decl)) >> > > + { >> > > + for (s = (*entry)->same_comdat_group; s != NULL && s != node; >> > > + s = s->same_comdat_group) >> > > + ; >> > >> > With no if-statement in the loop body you need an additional exit >> > condition for a case when you reach the entry. >> > >> > Thanks, >> > Ilya >> > >> >> Here is a patch to add a testcase, fix the loop and avoid same_comdat_group for instrumented external symbols. Does it look OK? > > OK >> >> BTW should we check same_comdat_group is NULL for external symbols? > > We could do that, yes. If you can come with a patch, it is OK for next stage1. Bootstrap fails with such check. Seems we may have same_comdat_group for external symbols with body. Ilya > > Honza
diff --git a/gcc/ipa-chkp.c b/gcc/ipa-chkp.c index a9933e2..3218d42 100644 --- a/gcc/ipa-chkp.c +++ b/gcc/ipa-chkp.c @@ -574,7 +574,8 @@ chkp_maybe_create_clone (tree fndecl) /* Clones have the same comdat group as originals. */ if (node->same_comdat_group - || DECL_ONE_ONLY (node->decl)) + || (DECL_ONE_ONLY (node->decl) + && !DECL_EXTERNAL (node->decl))) clone->add_to_same_comdat_group (node); if (gimple_has_body_p (fndecl)) diff --git a/gcc/symtab.c b/gcc/symtab.c index eb41d62..156fa3d 100644 --- a/gcc/symtab.c +++ b/gcc/symtab.c @@ -1132,7 +1132,8 @@ symtab_node::verify_symtab_nodes (void) *entry = node; else if (!DECL_EXTERNAL (node->decl)) { - for (s = (*entry)->same_comdat_group; s != NULL && s != node; + for (s = (*entry)->same_comdat_group; + s != NULL && s != node && s != *entry; s = s->same_comdat_group) ; if (!s || s == *entry) diff --git a/gcc/testsuite/gcc.target/i386/mpx/pr65531.cc b/gcc/testsuite/gcc.target/i386/mpx/pr65531.cc new file mode 100644 index 0000000..049569c --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/pr65531.cc @@ -0,0 +1,13 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fcheck-pointer-bounds -mmpx" } */ + +#pragma interface + +struct S +{ + ~S () + { + } +}; + +S s;