https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79672

            Bug ID: 79672
           Summary: ICE with -Wduplicated-branches -fopenmp
           Product: gcc
           Version: 7.0
            Status: UNCONFIRMED
          Keywords: ice-on-valid-code, openmp
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: reichelt at gcc dot gnu.org
  Target Milestone: ---

The followiong code snippet triggers an ICE on trunk when
compiled with "-Wduplicated-branches -fopenmp":

================================
template<int N> void foo()
{
  if (N > 0)
  {
#pragma omp parallel for
    for (int i = 0; i < 10; ++i) ;
  }
}

void bar()
{
  foo<0>();
}
================================

bug.cc: In instantiation of 'void foo() [with int N = 0]':
bug.cc:12:10:   required from here
bug.cc:8:1: internal compiler error: in add_expr, at tree.c:7925
 }
 ^
0xfe1677 inchash::add_expr(tree_node const*, inchash::hash&, unsigned int)
        ../../gcc/gcc/tree.c:7925
0xfe1af1 inchash::add_expr(tree_node const*, inchash::hash&, unsigned int)
        ../../gcc/gcc/tree.c:8010
0xfe1af1 inchash::add_expr(tree_node const*, inchash::hash&, unsigned int)
        ../../gcc/gcc/tree.c:8010
0xfe1af1 inchash::add_expr(tree_node const*, inchash::hash&, unsigned int)
        ../../gcc/gcc/tree.c:8010
0xfe1955 inchash::add_expr(tree_node const*, inchash::hash&, unsigned int)
        ../../gcc/gcc/tree.c:8010
0xfe1af1 inchash::add_expr(tree_node const*, inchash::hash&, unsigned int)
        ../../gcc/gcc/tree.c:8010
0x8a90a6 do_warn_duplicated_branches
        ../../gcc/gcc/c-family/c-warn.c:2263
0x8a90a6 do_warn_duplicated_branches_r(tree_node**, int*, void*)
        ../../gcc/gcc/c-family/c-warn.c:2290
0xff8a23 walk_tree_1(tree_node**, tree_node* (*)(tree_node**, int*, void*),
void*, hash_set<tree_node*, default_hash_traits<tree_node*> >*, tree_node*
(*)(tree_node**, int*, tree_node* (*)(tree_node**, int*, void*), void*,
hash_set<tree_node*, default_hash_traits<tree_node*> >*))
        ../../gcc/gcc/tree.c:11796
0xff85a0 walk_tree_without_duplicates_1(tree_node**, tree_node*
(*)(tree_node**, int*, void*), void*, tree_node* (*)(tree_node**, int*,
tree_node* (*)(tree_node**, int*, void*), void*, hash_set<tree_node*,
default_hash_traits<tree_node*> >*))
        ../../gcc/gcc/tree.c:12139
0x86cb42 c_genericize(tree_node*)
        ../../gcc/gcc/c-family/c-gimplify.c:129
0x7f3b11 cp_genericize(tree_node*)
        ../../gcc/gcc/cp/cp-gimplify.c:1649
0x60ddb2 finish_function(int)
        ../../gcc/gcc/cp/decl.c:15703
0x67ac1b instantiate_decl(tree_node*, bool, bool)
        ../../gcc/gcc/cp/pt.c:22858
0x680f8b instantiate_pending_templates(int)
        ../../gcc/gcc/cp/pt.c:22955
0x6c4918 c_parse_final_cleanups()
        ../../gcc/gcc/cp/decl2.c:4526
Please submit a full bug report, [etc.]

Reply via email to