[Bug 1895358] Re: [Bug] A simple code including tgmath.h cannot be compiled with icc with Ubuntu 20.04 OS
James Grey
1895358 at bugs.launchpad.net
Wed Jan 5 21:39:57 UTC 2022
> I'm starting to suspect that. Note that the bug as filed is with icc, not clang.
Indeed. That's why I wanted to see the fix, I assume some ifdef logic was used, so I could try to apply that fix to my case. But tbh I figured out that my code's include of tgmath.h was extraneous, so I just removed it and everything seems to be fine on my end.
> Do you have a shareable test case?
I don't have a quick test I can share right now. I can share the scenario:
1) Install CodeChecker dependencies:
sudo apt-get install automake bison flex g++ git libboost-all-dev libevent-dev libssl-dev libtool make pkg-config
2) Install CodeChecker:
sudo apt-get update
sudo apt-get upgrade
sudo apt-get dist-upgrade (reboot if does anything)
sudo npm install -g npm
sudo apt-get install automake bison flex g++ git libboost-all-dev libevent-dev libssl-dev libtool make pkg-config
sudo apt-get install clang clang-tidy clang-tools build-essential curl gcc-multilib git python3-dev python3-venv
curl -sL https://deb.nodesource.com/setup_12.x | sudo -E bash -
sudo apt-get install -y nodejs
git clone https://github.com/Ericsson/CodeChecker.git --depth 1 ~/codechecker
cd ~/codechecker
make package
cd ..
3) Add $HOME/codechecker/build/CodeChecker/bin to your PATH like example below
export PATH=$HOME/bin:$PHOME/bin:/usr/local/go/bin:$GOROOT/bin:$HOME/codechecker/build/CodeChecker/bin:$PATH
4) Have a piece of C code that includes tgmath.h, and run Codechecker on it like below:
CodeChecker log --build "make" --output ~/my_test_compile_commands.json
CodeChecker analyze ~/my_test_compile_commands.json --enable-all --enable sensitive --output ~/cc-my_test
At this point you'll see the clang-diagnostic-error message about an
unsupported combination of types.
As I said I have a workaround already, which is to not use tgmath.h
(lol). But maybe this will help someone else. Thanks for your
attention!
--
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to glibc in Ubuntu.
https://bugs.launchpad.net/bugs/1895358
Title:
[Bug] A simple code including tgmath.h cannot be compiled with icc
with Ubuntu 20.04 OS
Status in glibc package in Ubuntu:
Fix Released
Status in glibc source package in Focal:
Fix Released
Status in glibc source package in Groovy:
Won't Fix
Bug description:
[Impact]
A simple code including tgmath.h cannot be compiled with icc with
Ubuntu 20.04 OS and later releases.
[Test Case]
icc:
Compile the following code with Intel compiler (icc) by running “icc -c test.c”
$ cat test.c
#include <tgmath.h>
There should not be any compilation error
[Where problems could occur]
The fix is dropping compile time check preventing using float128 with
icc. In case of a mistake using float128 becomes prevented in other
compilers as well, but this is highly unlikely, since the vanilla
upstream code is known to work.
Older icc compilers (for which the patch has been introduced) will
stop compiling code with the _fixed_ tgmath.h because of LP: #1717257.
Users can still install older icc compilers from 3rd party sources,
but there is no good way of avoiding that. They can still override the
packaged tgmath.h.
[Original Bug Text]
[Summary]: A simple code including tgmath.h cannot be compiled with
icc with Ubuntu 20.04 OS
[Ubuntu OS version]: 20.04
[Reproduce Steps]: Compile the following code with Intel compiler
(icc) by running “icc -c test.c”
$ cat test.c
#include <tgmath.h>
[Results]
Expected: There should not be any compilation error
Actual: The following error is produced:
$ icc -c test.c
In file included from /localdisk2/mkl/aakkas/20200721_rls/lnx/compiler/latest/linux/bin/intel64/../../compiler/include/icc/tgmath.h(25),
from test.c(1):
/usr/include/tgmath.h(54): error: #error directive: "Unsupported combination of types for <tgmath.h>."
# error "Unsupported combination of types for <tgmath.h>."
^
compilation aborted for test.c (code 2)
[Additional Information on Test setup]:
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 red part below in floatn.h, which
comes with Ubuntu OS, should be updated/removed.
#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
Currently, when the tgmath.h system header file is included on Ubuntu
20.04 OS system, __HAVE_FLOAT128 is set to zero and __HAVE_FLOAT64X
set to 1 for ICC. And this is not a supported combination as checked
in the new tgmath.h system header file:
# if ((__HAVE_FLOAT64X && !__HAVE_FLOAT128) \
|| (__HAVE_FLOAT128 && !__HAVE_FLOAT64X))
# error "Unsupported combination of types for <tgmath.h>."
# endif
Upstream bug: Not known
=========================================
To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/glibc/+bug/1895358/+subscriptions
More information about the foundations-bugs
mailing list