gcc/
[official-gcc.git] / gcc / testsuite / g++.dg / pr71294.C
blob67675dd7e3060dfd61aa176f10275c1914b0da9e
1 // { dg-do compile { target { powerpc64*-*-* && lp64 } } }
2 // { dg-require-effective-target powerpc_p8vector_ok } */
3 // { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power8" } }
4 // { dg-options "-mcpu=power8 -O3 -fstack-protector" }
6 // PAR target/71294 failed because RELOAD could not figure how create a V2DI
7 // vector that auto vectorization created with each element being the same
8 // stack address, with stack-protector turned on.
10 class A;
11 template <typename _Tp, int m, int n> class B {
12 public:
13   _Tp val[m * n];
15 class C {
16 public:
17   C(A);
19 struct D {
20   D();
21   unsigned long &operator[](int);
22   unsigned long *p;
24 class A {
25 public:
26   template <typename _Tp, int m, int n> A(const B<_Tp, m, n> &, bool);
27   int rows, cols;
28   unsigned char *data;
29   unsigned char *datastart;
30   unsigned char *dataend;
31   unsigned char *datalimit;
32   D step;
34 template <typename _Tp, int m, int n>
35 A::A(const B<_Tp, m, n> &p1, bool)
36     : rows(m), cols(n) {
37   step[0] = cols * sizeof(_Tp);
38   datastart = data = (unsigned char *)p1.val;
39   datalimit = dataend = datastart + rows * step[0];
41 class F {
42 public:
43   static void compute(C);
44   template <typename _Tp, int m, int n, int nm>
45   static void compute(const B<_Tp, m, n> &, B<_Tp, nm, 1> &, B<_Tp, m, nm> &,
46                       B<_Tp, n, nm> &);
48 D::D() {}
49 unsigned long &D::operator[](int p1) { return p[p1]; }
50 template <typename _Tp, int m, int n, int nm>
51 void F::compute(const B<_Tp, m, n> &, B<_Tp, nm, 1> &, B<_Tp, m, nm> &,
52                 B<_Tp, n, nm> &p4) {
53   A a(p4, false);
54   compute(a);
56 void fn1() {
57   B<double, 4, 4> b, c, e;
58   B<double, 4, 1> d;
59   F::compute(b, d, c, e);