Issue 243355
Summary selected_real_kind(1) returns incorrect value
Labels new issue
Assignees
Reporter shivaramaarao
    selected_real_kind(1) returns kind 2 instead of kind 3 when both IEEE half precision and bfloat16 are enabled.

```program test
  print *, precision(1.0_2), precision(1.0_3)
  print *, selected_real_kind(1)
end program```

Flang prints:
3 2
2

Fortran 2018 16.9.170 says that when more than one real kind meets the request, the result is the kind with the smallest decimal precision. Kind 3 (bfloat16) has precision 2 and kind 2 (IEEE half) has precision 3, so selected_real_kind(1) must return 3. 
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to