[Bug 268497] clang15 math.h isfinite() generates unreachable-code-generic-assoc warnings

From: <bugzilla-noreply_at_freebsd.org>
Date: Wed, 21 Dec 2022 02:04:22 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=268497

            Bug ID: 268497
           Summary: clang15 math.h isfinite() generates
                    unreachable-code-generic-assoc warnings
           Product: Base System
           Version: 13.1-RELEASE
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Some People
          Priority: ---
         Component: misc
          Assignee: bugs@FreeBSD.org
          Reporter: nicholas.h.briggs@gmail.com

This appears to be a variant of #254714 coming back to life with clang15 --
Compiling

  int foo(void) { return isfinite(1.0f); }

with

  clang15  -c isfinitetest.c -o isfinitetest.o

generates

% clang15  -c isfinitetest.c -o isfinitetest.o 
isfinitetest.c:2:24: warning: due to lvalue conversion of the controlling
expression, association of type 'volatile float' will never be selected because
it is qualified [-Wunreachable-code-generic-assoc]
int foo(void) { return isfinite(1.0f); }
                       ^
/usr/include/math.h:110:21: note: expanded from macro 'isfinite'
#define isfinite(x) __fp_type_select(x, __isfinitef, __isfinite, __isfinitel)
                    ^
/usr/include/math.h:85:14: note: expanded from macro '__fp_type_select'
    volatile float: f(x),                                               \
             ^

(and so on for 8 more errors with all combinations of (volatile, const) x
(float, double))

This was not an issue with clang 13, but clang 15 introduced
-Wunreachable-code-generic-assoc and enabled it by default.

-- 
You are receiving this mail because:
You are the assignee for the bug.