This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: C++ PATCH for c++/68703 (dependent vector length)
- From: Jakub Jelinek <jakub at redhat dot com>
- To: Jason Merrill <jason at redhat dot com>
- Cc: gcc-patches List <gcc-patches at gcc dot gnu dot org>
- Date: Wed, 10 Aug 2016 00:11:29 +0200
- Subject: Re: C++ PATCH for c++/68703 (dependent vector length)
- Authentication-results: sourceware.org; auth=none
- References: <CADzB+2kwNtRA29WBKHB0GP=x62u62_vM4p6Wc531pguS_ASATA@mail.gmail.com>
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
On Tue, Aug 09, 2016 at 06:02:45PM -0400, Jason Merrill wrote:
> diff --git a/gcc/testsuite/g++.dg/ext/vector32.C b/gcc/testsuite/g++.dg/ext/vector32.C
> new file mode 100644
> index 0000000..8901d0b
> --- /dev/null
> +++ b/gcc/testsuite/g++.dg/ext/vector32.C
> @@ -0,0 +1,18 @@
> +// PR c++/68703
> +
> +template <int N>
> +struct D {
> + int v __attribute__((vector_size (N * sizeof (int))));
> + int f1 () { return this->v[N-1]; }
> + int f2 () { return v[N-1]; }
> +};
> +
> +int
> +main ()
> +{
> + D<4> a = { { 0, 1, 2, 3 } };
> + D<8> b = { { 0, 1, 2, 3, 4, 5, 6, 7 } };
> + if (a.f1 () != 3 || a.f2 () != 3
> + || b.f1 () != 7 || b.f2 () != 7)
> + __builtin_abort ();
> +}
> diff --git a/gcc/testsuite/g++.dg/ext/vector32a.C b/gcc/testsuite/g++.dg/ext/vector32a.C
> new file mode 100644
> index 0000000..8901d0b
> --- /dev/null
> +++ b/gcc/testsuite/g++.dg/ext/vector32a.C
This test is the same as the other one. Did you mean to use
typedef int V __attribute__((vector_size (N * sizeof (int))));
V v;
instead or something similar (where the attribute would live on
the type rather than on the FIELD_DECL?
Jakub