diff options
author | Richard Sandiford <richard.sandiford@arm.com> | 2019-12-23 09:43:46 +0000 |
---|---|---|
committer | Richard Sandiford <rsandifo@gcc.gnu.org> | 2019-12-23 09:43:46 +0000 |
commit | b8c9cc5100a8ba3aa56a6ffdd58d370cbb0134a4 (patch) | |
tree | dff0b758de52b2af42cc79a1e0c7362d5c89164d /gcc/cp | |
parent | 96bea935c08ab0773b02cdeed7a2c066744fe861 (diff) | |
download | gcc-b8c9cc5100a8ba3aa56a6ffdd58d370cbb0134a4.zip gcc-b8c9cc5100a8ba3aa56a6ffdd58d370cbb0134a4.tar.gz gcc-b8c9cc5100a8ba3aa56a6ffdd58d370cbb0134a4.tar.bz2 |
[C++] Make same_type_p return false for gnu_vector_type_p differences (PR 92789)
As Jason pointed out in the review of the C++ gnu_vector_type_p patch:
https://gcc.gnu.org/ml/gcc-patches/2019-12/msg00173.html
the real fix for the XFAILs in acle/general-c++/gnu_vectors_*.C is to
make same_type_p return false for two types if one is gnu_vector_type_p
and the other isn't. This patch does that and fixes the fallout.
Originally I'd tried to make it so that "X *" and "Y *" are
interconvertible whenever X and Y are, and similarly for
"X &" and "Y &". That doesn't fall out naturally though,
and is different from how -flax-vector-conversions works.
The patch therefore accepts all the consequences of making
X and Y !same_type_p instead of trying to work around them.
2019-12-23 Richard Sandiford <richard.sandiford@arm.com>
gcc/cp/
PR c++/92789
* typeck.c (structural_comptypes): Make sure that two vector types
agree on gnu_vector_type_p.
gcc/testsuite/
PR c++/92789
* g++.dg/ext/sve-sizeless-2.C (statements): Expect pointer
difference and comparisons between GNU and non-GNU types
to be rejected. Expect __is_same to be false for such pairs.
* g++.target/aarch64/sve/acle/general-c++/gnu_vectors_1.C: Remove
XFAILs. Expect conversions between SVE vector pointers and
GNU vector pointers to be rejected. Test references.
* g++.target/aarch64/sve/acle/general-c++/gnu_vectors_2.C: Likewise.
From-SVN: r279717
Diffstat (limited to 'gcc/cp')
-rw-r--r-- | gcc/cp/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/cp/typeck.c | 3 |
2 files changed, 8 insertions, 1 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 720c3ee..14c6d32 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,11 @@ 2019-12-23 Richard Sandiford <richard.sandiford@arm.com> + PR c++/92789 + * typeck.c (structural_comptypes): Make sure that two vector types + agree on gnu_vector_type_p. + +2019-12-23 Richard Sandiford <richard.sandiford@arm.com> + * cvt.c (ocp_convert): Apply rvalue to the source of vector conversions. * typeck.c (build_reinterpret_cast_1): Likewise. diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c index d2f4a00..18c1685 100644 --- a/gcc/cp/typeck.c +++ b/gcc/cp/typeck.c @@ -1425,7 +1425,8 @@ structural_comptypes (tree t1, tree t2, int strict) break; case VECTOR_TYPE: - if (maybe_ne (TYPE_VECTOR_SUBPARTS (t1), TYPE_VECTOR_SUBPARTS (t2)) + if (gnu_vector_type_p (t1) != gnu_vector_type_p (t2) + || maybe_ne (TYPE_VECTOR_SUBPARTS (t1), TYPE_VECTOR_SUBPARTS (t2)) || !same_type_p (TREE_TYPE (t1), TREE_TYPE (t2))) return false; break; |