public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug math/26621] New: ICC Error when including tgmath.h on Ubuntu 20.04
@ 2020-09-15 21:27 ahmet.akkas at intel dot com
  2020-09-15 21:54 ` [Bug math/26621] " hjl.tools at gmail dot com
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: ahmet.akkas at intel dot com @ 2020-09-15 21:27 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=26621

            Bug ID: 26621
           Summary: ICC Error when including tgmath.h on Ubuntu 20.04
           Product: glibc
           Version: 2.31
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: math
          Assignee: unassigned at sourceware dot org
          Reporter: ahmet.akkas at intel dot com
  Target Milestone: ---

A simple code including tgmath.h cannot be compiled with icc (Intel C/C++
compiler) with Ubuntu 20.04 OS. To re-produce it, please compile the following
code by running “icc -c test.c”
$ cat test.c
#include <tgmath.h>

$ icc -c test.c

Produces the following error:

/usr/include/tgmath.h(54): error: #error directive: "Unsupported combination of
types for <tgmath.h>."
  #  error "Unsupported combination of types for <tgmath.h>."


I believe that the fix requires an update in floatn.h system file. Currently,
__HAVE_FLOAT128 is set to zero for ICC with the following #if-defined:

#if (defined __x86_64__ \
     ? __GNUC_PREREQ (4, 3) \
     : (defined __GNU__ ? __GNUC_PREREQ (4, 5) : __GNUC_PREREQ (4, 4))) \
     && !defined(__CUDACC__) && !defined(__ICC)
# define __HAVE_FLOAT128 1
#else
# define __HAVE_FLOAT128 0
#endif

And then the "Unsupported combination of types for <tgmath.h>." error is
produced from the following code in tgmath.h system header file (note that
__HAVE_FLOAT64X is already set to 1 for ICC):

# if ((__HAVE_FLOAT64X && !__HAVE_FLOAT128) \
      || (__HAVE_FLOAT128 && !__HAVE_FLOAT64X))
# error "Unsupported combination of types for <tgmath.h>."
# endif


ICC compiler supports the __float128 type if the reference compiler is more
recent than GNU version 4.4. Therefore, __HAVE_FLOAT128 should be set to 1 when
ICC compiler is used with GNU version higher than 4.4. Based on this, I believe
that the "&& !defined(__ICC)" part in the above #if-defined should be
removed/updated.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug math/26621] ICC Error when including tgmath.h on Ubuntu 20.04
  2020-09-15 21:27 [Bug math/26621] New: ICC Error when including tgmath.h on Ubuntu 20.04 ahmet.akkas at intel dot com
@ 2020-09-15 21:54 ` hjl.tools at gmail dot com
  2020-09-15 21:55 ` hjl.tools at gmail dot com
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: hjl.tools at gmail dot com @ 2020-09-15 21:54 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=26621

H.J. Lu <hjl.tools at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2020-09-15
           Assignee|unassigned at sourceware dot org   |hjl.tools at gmail dot com
     Ever confirmed|0                           |1
             Status|UNCONFIRMED                 |NEW

--- Comment #1 from H.J. Lu <hjl.tools at gmail dot com> ---
Created attachment 12843
  --> https://sourceware.org/bugzilla/attachment.cgi?id=12843&action=edit
A patch

Does ICC define __HAVE_FLOAT128?

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug math/26621] ICC Error when including tgmath.h on Ubuntu 20.04
  2020-09-15 21:27 [Bug math/26621] New: ICC Error when including tgmath.h on Ubuntu 20.04 ahmet.akkas at intel dot com
  2020-09-15 21:54 ` [Bug math/26621] " hjl.tools at gmail dot com
@ 2020-09-15 21:55 ` hjl.tools at gmail dot com
  2020-09-15 21:55 ` hjl.tools at gmail dot com
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: hjl.tools at gmail dot com @ 2020-09-15 21:55 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=26621

H.J. Lu <hjl.tools at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Version|2.31                        |2.33
   Target Milestone|---                         |2.33

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug math/26621] ICC Error when including tgmath.h on Ubuntu 20.04
  2020-09-15 21:27 [Bug math/26621] New: ICC Error when including tgmath.h on Ubuntu 20.04 ahmet.akkas at intel dot com
  2020-09-15 21:54 ` [Bug math/26621] " hjl.tools at gmail dot com
  2020-09-15 21:55 ` hjl.tools at gmail dot com
@ 2020-09-15 21:55 ` hjl.tools at gmail dot com
  2020-09-15 21:59 ` hjl.tools at gmail dot com
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: hjl.tools at gmail dot com @ 2020-09-15 21:55 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=26621

--- Comment #2 from H.J. Lu <hjl.tools at gmail dot com> ---
Does ICC define __SIZEOF_FLOAT128__?

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug math/26621] ICC Error when including tgmath.h on Ubuntu 20.04
  2020-09-15 21:27 [Bug math/26621] New: ICC Error when including tgmath.h on Ubuntu 20.04 ahmet.akkas at intel dot com
                   ` (2 preceding siblings ...)
  2020-09-15 21:55 ` hjl.tools at gmail dot com
@ 2020-09-15 21:59 ` hjl.tools at gmail dot com
  2020-09-15 22:05 ` joseph at codesourcery dot com
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: hjl.tools at gmail dot com @ 2020-09-15 21:59 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=26621

--- Comment #3 from H.J. Lu <hjl.tools at gmail dot com> ---
Both GCC and clang define __SIZEOF_FLOAT128__ to 16:

[hjl@gnu-cfl-1 glibc]$ echo __SIZEOF_FLOAT128__ | gcc -E -
# 1 "<stdin>"
# 1 "<built-in>"
# 1 "<command-line>"
# 31 "<command-line>"
# 1 "/usr/include/stdc-predef.h" 1 3 4
# 32 "<command-line>" 2
# 1 "<stdin>"
16
[hjl@gnu-cfl-1 glibc]$ echo __SIZEOF_FLOAT128__ | clang -E -
# 1 "<stdin>"
# 1 "<built-in>" 1
# 1 "<built-in>" 3
# 341 "<built-in>" 3
# 1 "<command line>" 1
# 1 "<built-in>" 2
# 1 "<stdin>" 2
16
[hjl@gnu-cfl-1 glibc]$

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug math/26621] ICC Error when including tgmath.h on Ubuntu 20.04
  2020-09-15 21:27 [Bug math/26621] New: ICC Error when including tgmath.h on Ubuntu 20.04 ahmet.akkas at intel dot com
                   ` (3 preceding siblings ...)
  2020-09-15 21:59 ` hjl.tools at gmail dot com
@ 2020-09-15 22:05 ` joseph at codesourcery dot com
  2020-09-15 23:02 ` ahmet.akkas at intel dot com
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: joseph at codesourcery dot com @ 2020-09-15 22:05 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=26621

--- Comment #4 from joseph at codesourcery dot com <joseph at codesourcery dot com> ---
The real question here is whether ICC supports any of the approaches used 
in glibc's tgmath.h to implement the type-generic macros, which involve 
various GCC extensions.  If it doesn't support them, the "#if 
__GNUC_PREREQ (2, 7)" would need to change to disallow ICC, or else a new 
implementation approach would need to be added.  If it does support them, 
then we get into ensuring the other macros regarding supported types are 
defined appropriately for the ICC case.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug math/26621] ICC Error when including tgmath.h on Ubuntu 20.04
  2020-09-15 21:27 [Bug math/26621] New: ICC Error when including tgmath.h on Ubuntu 20.04 ahmet.akkas at intel dot com
                   ` (4 preceding siblings ...)
  2020-09-15 22:05 ` joseph at codesourcery dot com
@ 2020-09-15 23:02 ` ahmet.akkas at intel dot com
  2020-09-15 23:15 ` hjl.tools at gmail dot com
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: ahmet.akkas at intel dot com @ 2020-09-15 23:02 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=26621

--- Comment #5 from Ahmet <ahmet.akkas at intel dot com> ---
(In reply to H.J. Lu from comment #2)
> Does ICC define __SIZEOF_FLOAT128__?

Yes.
# 1 "-"
# 1 "/usr/include/stdc-predef.h" 1 3

# 1 "-" 2
16

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug math/26621] ICC Error when including tgmath.h on Ubuntu 20.04
  2020-09-15 21:27 [Bug math/26621] New: ICC Error when including tgmath.h on Ubuntu 20.04 ahmet.akkas at intel dot com
                   ` (5 preceding siblings ...)
  2020-09-15 23:02 ` ahmet.akkas at intel dot com
@ 2020-09-15 23:15 ` hjl.tools at gmail dot com
  2020-09-16 16:28 ` ahmet.akkas at intel dot com
  2020-09-16 16:35 ` hjl.tools at gmail dot com
  8 siblings, 0 replies; 10+ messages in thread
From: hjl.tools at gmail dot com @ 2020-09-15 23:15 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=26621

--- Comment #6 from H.J. Lu <hjl.tools at gmail dot com> ---
(In reply to Ahmet from comment #5)
> (In reply to H.J. Lu from comment #2)
> > Does ICC define __SIZEOF_FLOAT128__?
> 
> Yes.
> # 1 "-"
> # 1 "/usr/include/stdc-predef.h" 1 3
> 
> # 1 "-" 2
> 16

Please apply my patch on /usr/include/bits/floatn.h to check if it
fixes your ICC problem.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug math/26621] ICC Error when including tgmath.h on Ubuntu 20.04
  2020-09-15 21:27 [Bug math/26621] New: ICC Error when including tgmath.h on Ubuntu 20.04 ahmet.akkas at intel dot com
                   ` (6 preceding siblings ...)
  2020-09-15 23:15 ` hjl.tools at gmail dot com
@ 2020-09-16 16:28 ` ahmet.akkas at intel dot com
  2020-09-16 16:35 ` hjl.tools at gmail dot com
  8 siblings, 0 replies; 10+ messages in thread
From: ahmet.akkas at intel dot com @ 2020-09-16 16:28 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=26621

--- Comment #7 from Ahmet <ahmet.akkas at intel dot com> ---
(In reply to joseph@codesourcery.com from comment #4)
> The real question here is whether ICC supports any of the approaches used 
> in glibc's tgmath.h to implement the type-generic macros, which involve 
> various GCC extensions.  If it doesn't support them, the "#if 
> __GNUC_PREREQ (2, 7)" would need to change to disallow ICC, or else a new 
> implementation approach would need to be added.  If it does support them, 
> then we get into ensuring the other macros regarding supported types are 
> defined appropriately for the ICC case.

We just found that Ubuntu's modified glibc header file caused the problem. In
the (latest) glibc sources the following line does not exist

    &&  !defined(__CUDACC__) && !defined(__ICC)

so the code in glibc's header file looks like this:

#if (defined __x86_64__   \
    ? __GNUC_PREREQ (4, 3)\
    : (defined __GNU__ ? __GNUC_PREREQ (4, 5) : __GNUC_PREREQ (4, 4)))
# define __HAVE_FLOAT128 1
#else
# define __HAVE_FLOAT128 0
#endif

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug math/26621] ICC Error when including tgmath.h on Ubuntu 20.04
  2020-09-15 21:27 [Bug math/26621] New: ICC Error when including tgmath.h on Ubuntu 20.04 ahmet.akkas at intel dot com
                   ` (7 preceding siblings ...)
  2020-09-16 16:28 ` ahmet.akkas at intel dot com
@ 2020-09-16 16:35 ` hjl.tools at gmail dot com
  8 siblings, 0 replies; 10+ messages in thread
From: hjl.tools at gmail dot com @ 2020-09-16 16:35 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=26621

H.J. Lu <hjl.tools at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |INVALID

--- Comment #8 from H.J. Lu <hjl.tools at gmail dot com> ---
Since the unmodified header file works with ICC, please report this bug
to Ubuntu.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2020-09-16 16:35 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-15 21:27 [Bug math/26621] New: ICC Error when including tgmath.h on Ubuntu 20.04 ahmet.akkas at intel dot com
2020-09-15 21:54 ` [Bug math/26621] " hjl.tools at gmail dot com
2020-09-15 21:55 ` hjl.tools at gmail dot com
2020-09-15 21:55 ` hjl.tools at gmail dot com
2020-09-15 21:59 ` hjl.tools at gmail dot com
2020-09-15 22:05 ` joseph at codesourcery dot com
2020-09-15 23:02 ` ahmet.akkas at intel dot com
2020-09-15 23:15 ` hjl.tools at gmail dot com
2020-09-16 16:28 ` ahmet.akkas at intel dot com
2020-09-16 16:35 ` hjl.tools at gmail dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).