http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58567

            Bug ID: 58567
           Summary: [4.8/4.9 Regression] ICE with invalid loop variable in
                    template using openmp
           Product: gcc
           Version: 4.9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: reichelt at gcc dot gnu.org

The following invalid code snippet (compiled with "-fopenmp") triggers an ICE
since GCC 4.8.0:

================================================
template<typename T> void foo()
{
  #pragma omp parallel for
  for (typename T::X i = 0; i < 100; ++i)
    ;
}

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

bug.cc: In instantiation of 'void foo() [with T = int]':
bug.cc:10:12:   required from here
bug.cc:4:22: error: 'int' is not a class, struct, or union type
   for (typename T::X i = 0; i < 100; ++i)
                      ^
bug.cc:4:3: internal compiler error: tree check: expected tree that contains
'decl common' structure, have 'error_mark' in tsubst_omp_for_iterator, at
cp/pt.c:12938
   for (typename T::X i = 0; i < 100; ++i)
   ^
0xcdaef7 tree_contains_struct_check_failed(tree_node const*,
tree_node_structure_enum, char const*, int, char const*)
        ../../gcc/gcc/tree.c:9348
0x5aa6b1 contains_struct_check
        ../../gcc/gcc/tree.h:2723
0x5aa6b1 tsubst_omp_for_iterator
        ../../gcc/gcc/cp/pt.c:12938
0x5a55ee tsubst_expr
        ../../gcc/gcc/cp/pt.c:13481
0x5a43d8 tsubst_expr
        ../../gcc/gcc/cp/pt.c:13446
0x5a4451 tsubst_expr
        ../../gcc/gcc/cp/pt.c:13284
0x5a1dcf instantiate_decl(tree_node*, int, bool)
        ../../gcc/gcc/cp/pt.c:19391
0x5de71f instantiate_pending_templates(int)
        ../../gcc/gcc/cp/pt.c:19492
0x6198c7 cp_write_global_declarations()
        ../../gcc/gcc/cp/decl2.c:4060
Please submit a full bug report, [etc.]

Reply via email to