================
@@ -189,6 +189,9 @@ def warn_openmp_spec_incomplete : Warning<
   "the specification for OpenMP version %0 is still under development; "
   "the syntax and semantics of new features may be subject to change">,
   InGroup<ExperimentalOption>;
+def warn_real_kind_consistency_for_flang : Warning<
+  "'-fdisable-real-16' may cause SELECTED_REAL_KIND to return inconsistent 
results">,
----------------
s-watanabe314 wrote:

My understanding is that the inconsistency comes from the difference between 
compile-time folding and runtime evaluation. For example:
```Fortran
  integer, parameter :: x = selected_real_kind(p=33)  ! folded to -1 with 
-fdisable-real-16

  integer :: y
  y = selected_real_kind(p=33)  ! still returns 16 at runtime
```

Only `SELECTED_REAL_KIND` invocations that would otherwise select `REAL(16)` 
are affected. Calls that select other real kinds are unaffected.

This happens because the runtime implementation does not currently take into 
account which real kinds the frontend considers available. As a result, 
compile-time folding and runtime evaluation can produce different results in 
some cases. The inconsistency is not introduced by this patch; it already 
exists due to the current separation between frontend folding and runtime 
evaluation.
https://godbolt.org/z/vjcdqMxvP

https://github.com/llvm/llvm-project/pull/221904
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to