On Fri, 18 Aug 2023 at 20:08, FX Coudert via Gcc <gcc@gcc.gnu.org> wrote:
>
> Hello,
>
> On the WIP aarch64-darwin port of GCC 
> (https://github.com/iains/gcc-darwin-arm64), there are some C++ testsuite 
> failures which are due to the following:
>
> 1. The testsuite check_effective_target_has_q_floating_suffix check tries to 
> compile the code "float dummy = 1.0q;” to determine if the q suffix is 
> allowed on floating-point types.
>
> 2. The check should pass on aarch64-darwin, and indeed the code compiles, 
> because the q suffix matches the _Float128 type.
>
> 3. However, a warning is emitted which makes the test fail:
>
> a.cpp:1:15: warning: converting to 'float' from '_Float128' with greater 
> conversion rank
>     1 | float dummy = 1.0q;
>       |               ^~~~
>
>
> 4. Therefore, the expectations of the different tests fail.
>
>
> Now, I am not sure why other targets are not affected in the same way, for 
> example, x86_64-linux or x86_64-darwin. Also, I am unsure: is the warning 
> warranted here? If so, we should adjust the check to silence warnings, or use 
> a cast. Or is the warning emitted in error?

It's probably because 1.0q produces __float128 on those targets, not
_Float128. In C++23 _Float128 (and _Float32 etc.) have special rules
about implicit conversions to other floating-point types.

I don't know why 1.0q is _Float128 on aarch64 instead of __float128.

I was going to suggest that using 'long double dummy = 1.0q' instead
of 'float' would help, but IIRC the Apple M1 ABI says that long double
is the same type as double, and so 'long double' would still have
lower conversion rank than _Float128.

An explicit cast prevents the warning:

float dummy = (float) 1.0q;

Reply via email to