[llvm-bugs] [Bug 31653] New: Clang should communicate it's support for annex F (IEC 60559 / IEEE-754) to glibc

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Jan 16 09:02:22 PST 2017


https://llvm.org/bugs/show_bug.cgi?id=31653

            Bug ID: 31653
           Summary: Clang should communicate it's support for annex F (IEC
                    60559 / IEEE-754) to glibc
           Product: clang
           Version: 3.9
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Headers
          Assignee: unassignedclangbugs at nondot.org
          Reporter: dan at su-root.co.uk
                CC: andrew.kaylor at intel.com, david.l.kreitzer at intel.com,
                    hfinkel at anl.gov, llvm-bugs at lists.llvm.org,
                    scanon at apple.com
    Classification: Unclassified

It seems with Clang (3.9) on Linux with glibc 2.24 that the `__STDC_IEC_559__`
macro is defined by glibc itself by `/usr/include/stdc-predef.h` (gets included
by clang if a glibc header gets included like `stdio.h`).

that code does

```
/* glibc's intent is to support the IEC 559 math functionality, real
   and complex.  If the GCC (4.9 and later) predefined macros
   specifying compiler intent are available, use them to determine
   whether the overall intent is to support these features; otherwise,
   presume an older compiler has intent to support these features and
   define these macros by default.  */

#ifdef __GCC_IEC_559
# if __GCC_IEC_559 > 0
#  define __STDC_IEC_559__ 1
# endif
#else
# define __STDC_IEC_559__ 1
#endif
```

Clang doesn't define `_GCC_IEC_559` so glibc defines `__STDC_IEC_559__ ` to be
`1` regardless of whether or not Clang supports it (does it?
https://llvm.org/bugs/show_bug.cgi?format=multiple&id=17000 suggests that Clang
doesn't).

This doesn't seem to be desirable. You can see above how glibc checks the
`_GCC_IEC_559` macro from gcc to test whether or gcc intends to support annex
F. I think we should do something similar to gcc so that Clang can control the
`__STDC_IEC_559__` macro when using glibc.

Depending on the implementation (i.e. whether or not we reuse the
`_GCC_IEC_559` macro) we choose we may need to speak to the glibc developers.

For context here are the gcc and glibc patches that landed a few years ago.

https://gcc.gnu.org/ml/gcc-patches/2013-10/msg01131.html
https://sourceware.org/ml/libc-alpha/2013-10/msg00515.html

Those patches include good explanations of their motivation.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20170116/fc2126c4/attachment.html>


More information about the llvm-bugs mailing list