Bug#1076160: g++: _Float16 does not work in G++ (works in GCC) on aarch64
Hi,
I could reproduce the problem with GCC 12 on aarch64, but not with GCC
13 and 14.
Using the following test program:
#include <stdio.h>
float test(_Float16 x){
return x;
}
int main() {
printf("%f\n", test(1.0));
}
This is the error message you get on aarch64 with g++-12:
$ g++-12 x.c
x.c:3:12: error: '_Float16' was not declared in this scope; did you mean '_Float64'?
3 | float test(_Float16 x){
| ^~~~~~~~
| _Float64
x.c: In function 'int main()':
x.c:8:22: error: 'test' cannot be used as a function
8 | printf("%f\n", test(1.0));
| ~~~~^~~~~
The same program builds fine with g++-12 on x86_64.
Note that with GCC 13 and 14 the code compiles and works (ie: it prints
"1.000000") albeit with some warnings. This is the same behavior you get
on x86_64 as well, with GCC 13 and 14.
$ g++-13 x.c
x.c: In function 'int main()':
x.c:8:23: warning: converting to '_Float16' from 'double' with greater conversion rank
8 | printf("%f\n", test(1.0));
| ^~~
x.c:3:21: note: initializing argument 1 of 'float test(_Float16)'
3 | float test(_Float16 x){
| ~~~~~~~~~^
Reply to: