Since FLT_EVAL_METHOD only accepts negative value, 0, 1 or 2.

gcc/c-family/ChangeLog:

        PR c/100854
        * c-common.c (excess_precision_mode_join): Return
        FLT_EVAL_METHOD_PROMOTE_TO_FLOAT when both x and y are
        FLT_EVAL_METHOD_PROMOTE_TO_FLOAT16.
---
 gcc/c-family/c-common.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/gcc/c-family/c-common.c b/gcc/c-family/c-common.c
index a25d59fa77b..4dab4d60773 100644
--- a/gcc/c-family/c-common.c
+++ b/gcc/c-family/c-common.c
@@ -8842,6 +8842,10 @@ excess_precision_mode_join (enum flt_eval_method x,
       || y == FLT_EVAL_METHOD_UNPREDICTABLE)
     return FLT_EVAL_METHOD_UNPREDICTABLE;
 
+  /* FLT_EVAL_METHOD only accepts negative values, 0, 1 or 2, but
+     FLT_EVAL_METHOD_PROMOTE_TO_FLOAT16 is 16.  */
+    if (x == y && x == FLT_EVAL_METHOD_PROMOTE_TO_FLOAT16)
+      return FLT_EVAL_METHOD_PROMOTE_TO_FLOAT;
   /* GCC only supports one interchange type right now, _Float16.  If
      we're evaluating _Float16 in 16-bit precision, then flt_eval_method
      will be FLT_EVAL_METHOD_PROMOTE_TO_FLOAT16.  */
-- 
2.18.1

Reply via email to