Compiling this testcase with -march=armv8.2-a+sve -msve-vector-bits=512: ---------------------------------------------------------- typedef __SVFloat32_t foo; typedef foo bar __attribute__((arm_sve_vector_bits(512))); template<typename T> struct s { T x; }; extern s<bar> a; bar &b = a.x; ---------------------------------------------------------- gave the bogus error: cannot bind non-const lvalue reference of type ‘bar&’ to an rvalue of type ‘bar’ The testcase works if the attribute is applied directly to __SVFloat32_t instead of via foo. This shows a more general problem with the way that we were handling the arm_sve_vector_bits attribute: we started by building a distinct copy of the type to which the attribute was applied, instead of starting with its main variant. This new type then became its own main variant, meaning that the relationship between types that have the attribute could be different from the relationship between types that don't have the attribute. This patch instead copies the main variant of the original type and then reapplies all the differences. gcc/ PR target/95105 * config/aarch64/aarch64-sve-builtins.cc (handle_arm_sve_vector_bits_attribute): Create a copy of the original type's TYPE_MAIN_VARIANT, then reapply all the differences between the original type and its main variant. gcc/testsuite/ PR target/95105 * gcc.target/aarch64/sve/acle/general/attributes_8.c: New test. * g++.target/aarch64/sve/acle/general-c++/attributes_1.C: Likewise.
Name |
Last commit
|
Last update |
---|---|---|
.. | ||
sve | Loading commit data... | |
sve2/acle | Loading commit data... | |
aarch64.exp | Loading commit data... | |
bfloat_cpp_typecheck.C | Loading commit data... | |
diag_aka_1.C | Loading commit data... | |
no_unique_address_1.C | Loading commit data... | |
no_unique_address_2.C | Loading commit data... | |
pr89752.C | Loading commit data... | |
pr94052.C | Loading commit data... | |
pr94514.C | Loading commit data... | |
pr94515-1.C | Loading commit data... | |
pr94515-2.C | Loading commit data... | |
return_address_sign_ab_exception.C | Loading commit data... | |
return_address_sign_b_exception.C | Loading commit data... |