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

            Bug ID: 95063
           Summary: [11 Regression] ICE in tsubst_decl, at cp/pt.c:14633
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: asolokha at gmx dot com
  Target Milestone: ---

g++-11.0.0-alpha20200510 snapshot (g:13a46321516e2efd3bbb1f1899c539c6724240a9)
ICEs when compiling the following testcase, extracted from
test/OpenMP/for_ast_print.cpp from the clang 10.0.0 test suite, w/ -fopenmp:

struct S {
  S(): a(0) {}
  S(int v) : a(v) {}
  int a;
  typedef int type;
};

template <typename T>
class S7 : public T {
protected:
  T a;
  T &b;
  typename T::type c:12;
  typename T::type &d;

public:
  S7(typename T::type v) : a(v), b(a), c(v), d(a.a) {
#pragma omp for linear(val(c))
    for (int k = 0; k < a.a; ++k)
      ++this->a.a;
  }
};

class S8 : public S7<S> {
public:
  S8(int v) : S7<S>(v) {
  }
};

% g++-11.0.0 -fopenmp -c epvsqux2.cpp
epvsqux2.cpp: In constructor 'S7<T>::S7(typename T::type)':
epvsqux2.cpp:18:28: error: modifier should not be specified in 'linear' clause
on 'simd' or 'for' constructs
   18 | #pragma omp for linear(val(c))
      |                            ^
epvsqux2.cpp: In instantiation of 'S7<T>::S7(typename T::type) [with T = S;
typename T::type = int]':
epvsqux2.cpp:26:22:   required from here
epvsqux2.cpp:18:31: internal compiler error: in tsubst_decl, at cp/pt.c:14633
   18 | #pragma omp for linear(val(c))
      |                               ^
0x6607d0 tsubst_decl
       
/var/tmp/portage/sys-devel/gcc-11.0.0_alpha20200510/work/gcc-11-20200510/gcc/cp/pt.c:14633
0x9f6fa6 tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
       
/var/tmp/portage/sys-devel/gcc-11.0.0_alpha20200510/work/gcc-11-20200510/gcc/cp/pt.c:17938
0x9f4ea0 tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
       
/var/tmp/portage/sys-devel/gcc-11.0.0_alpha20200510/work/gcc-11-20200510/gcc/cp/pt.c:17836
0x9f51f7 tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
       
/var/tmp/portage/sys-devel/gcc-11.0.0_alpha20200510/work/gcc-11-20200510/gcc/cp/pt.c:18155
0x9f4ea0 tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
       
/var/tmp/portage/sys-devel/gcc-11.0.0_alpha20200510/work/gcc-11-20200510/gcc/cp/pt.c:17836
0x9f51f7 tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
       
/var/tmp/portage/sys-devel/gcc-11.0.0_alpha20200510/work/gcc-11-20200510/gcc/cp/pt.c:18155
0x9f22fa instantiate_decl(tree_node*, bool, bool)
       
/var/tmp/portage/sys-devel/gcc-11.0.0_alpha20200510/work/gcc-11-20200510/gcc/cp/pt.c:25708
0xa2335b instantiate_pending_templates(int)
       
/var/tmp/portage/sys-devel/gcc-11.0.0_alpha20200510/work/gcc-11-20200510/gcc/cp/pt.c:25824
0x9276e3 c_parse_final_cleanups()
       
/var/tmp/portage/sys-devel/gcc-11.0.0_alpha20200510/work/gcc-11-20200510/gcc/cp/decl2.c:4889

clang++ 10.0.0 accepts this code.

Reply via email to