On Sun, 3 Jun 2018, Jakub Jelinek wrote: > Hi! > > The second argument of OMP_CRITICAL is IDENTIFIER_NODE, but we were ICEing > on that with -Wduplicate-branches, because we didn't know how to hash it. > operand_equal_p handles it the way it should, only pointer equal > IDENTIFIER_NODEs are the same. > > Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?
OK. Richard. > 2018-06-03 Jakub Jelinek <ja...@redhat.com> > > PR c++/86025 > * tree.c (inchash::add_expr): Handle IDENTIFIER_NODE. > > * c-c++-common/gomp/pr86025.c: New test. > > --- gcc/tree.c.jj 2018-05-25 14:34:36.869377392 +0200 > +++ gcc/tree.c 2018-06-01 15:36:40.882938758 +0200 > @@ -7360,6 +7360,9 @@ add_expr (const_tree t, inchash::hash &h > for (i = 0; i < TREE_VEC_LENGTH (t); ++i) > inchash::add_expr (TREE_VEC_ELT (t, i), hstate, flags); > return; > + case IDENTIFIER_NODE: > + hstate.add_object (IDENTIFIER_HASH_VALUE (t)); > + return; > case FUNCTION_DECL: > /* When referring to a built-in FUNCTION_DECL, use the __builtin__ > form. > Otherwise nodes that compare equal according to operand_equal_p might > --- gcc/testsuite/c-c++-common/gomp/pr86025.c.jj 2018-06-01 > 15:55:50.377382152 +0200 > +++ gcc/testsuite/c-c++-common/gomp/pr86025.c 2018-06-01 15:55:32.632359904 > +0200 > @@ -0,0 +1,20 @@ > +/* PR c++/86025 */ > +/* { dg-do compile } */ > +/* { dg-additional-options "-Wduplicated-branches" } */ > + > +int i; > + > +void > +foo (int x) > +{ > + if (x) > + { > + #pragma omp critical (foo) > + i++; > + } > + else > + { > + #pragma omp critical > + i++; > + } > +} > > Jakub > > -- Richard Biener <rguent...@suse.de> SUSE LINUX GmbH, GF: Felix Imendoerffer, Jane Smithard, Graham Norton, HRB 21284 (AG Nuernberg)