clang errors with __float128 is not supported on this target on ppc64le

Bug #1783705 reported by Joel Stanley
12
This bug affects 1 person
Affects Status Importance Assigned to Milestone
gcc-8 (Ubuntu)
Fix Released
Undecided
Matthias Klose
Bionic
Fix Released
Undecided
Unassigned

Bug Description

Running Ubuntu cosmic on ppc64le, since the GCC 8 update I am unable to compile programs with clang that include cmath:

$ cat foo.cpp
#include <cmath>
int main() { }

$ clang++ foo.cpp
In file included from foo.cpp:1:
In file included from /usr/bin/../lib/gcc/powerpc64le-linux-gnu/8/../../../../include/c++/8/cmath:47:
/usr/bin/../lib/gcc/powerpc64le-linux-gnu/8/../../../../include/c++/8/bits/std_abs.h:102:7: error:
      __float128 is not supported on this target
  abs(__float128 __x)
      ^
/usr/bin/../lib/gcc/powerpc64le-linux-gnu/8/../../../../include/c++/8/bits/std_abs.h:101:3: error:
      __float128 is not supported on this target
  __float128
  ^
2 errors generated.

GCC works fine. If I add -mfloat128, it fails with this error:

$ clang++ -mfloat128 foo.cpp
In file included from foo.cpp:1:
In file included from /usr/bin/../lib/gcc/powerpc64le-linux-gnu/8/../../../../include/c++/8/cmath:45:
In file included from /usr/include/math.h:43:
/usr/include/powerpc64le-linux-gnu/bits/floatn.h:72:52: error: unknown machine mode '__KC__'
typedef _Complex float __cfloat128 __attribute__ ((__mode__ (__KC__)));
                                                   ^

$ clang++ --version
clang version 6.0.1-2ubuntu1 (tags/RELEASE_601/final)
Target: powerpc64le-unknown-linux-gnu

libc6: 2.27-3ubuntu1
clang: 6.0-41ubuntu1
gcc: 4:8.1.0-2ubuntu1

ProblemType: Bug
DistroRelease: Ubuntu 18.10
Package: clang 1:6.0-41ubuntu1
Uname: Linux 4.18.0-041800rc6-generic ppc64le
ApportVersion: 2.20.10-0ubuntu5
Architecture: ppc64el
Date: Thu Jul 26 16:27:16 2018
ProcEnviron:
 TERM=xterm-256color
 PATH=(custom, no user)
 XDG_RUNTIME_DIR=<set>
 LANG=en_US.UTF-8
 SHELL=/bin/bash
ProcLoadAvg: 0.15 1.70 2.08 1/1654 18418
ProcLocks:
 1: FLOCK ADVISORY WRITE 4151 00:32:46558 0 EOF
 2: FLOCK ADVISORY WRITE 3971 00:1a:62741 0 EOF
 3: FLOCK ADVISORY WRITE 3418 00:32:85157 0 EOF
 4: FLOCK ADVISORY WRITE 3104 00:17:44175 0 EOF
 5: POSIX ADVISORY WRITE 3109 00:17:39081 0 EOF
ProcSwaps:
 Filename Type Size Used Priority
 /swapfile file 2097088 0 -2
ProcVersion: Linux version 4.18.0-041800rc6-generic (kernel@tangerine) (gcc version 8.1.0 (Ubuntu 8.1.0-11ubuntu1)) #201807221830 SMP Sun Jul 22 23:58:55 UTC 2018
SourcePackage: llvm-defaults
UpgradeStatus: No upgrade log present (probably fresh install)
VarLogDump_list: total 0
cpu_cores: Number of cores present = 32
cpu_coreson: Number of cores online = 32
cpu_smt: SMT=4

Revision history for this message
Joel Stanley (shenki) wrote :
Revision history for this message
Joel Stanley (shenki) wrote :

The error is due to clang using this header:

/usr/include/powerpc64le-linux-gnu/c++/8/bits/c++config.h

The difference between this header for gcc7 and gcc8:

--- /usr/include/powerpc64le-linux-gnu/c++/7/bits/c++config.h 2018-07-20 21:27:51.000000000 +0930
+++ /usr/include/powerpc64le-linux-gnu/c++/8/bits/c++config.h 2018-07-28 15:23:29.000000000 +0930
@@ -1550,7 +1531,7 @@ namespace std
 #define _GLIBCXX_USE_FCHMODAT 1

 /* Define if __float128 is supported on this host. */
-/* #undef _GLIBCXX_USE_FLOAT128 */
+#define _GLIBCXX_USE_FLOAT128 1

 /* Defined if gettimeofday is available. */
 #define _GLIBCXX_USE_GETTIMEOFDAY 1

$ dpkg -S /usr/include/powerpc64le-linux-gnu/c++/8/bits/c++config.h
libstdc++-8-dev:ppc64el: /usr/include/powerpc64le-linux-gnu/c++/8/bits/c++config.h

$ apt-cache policy libstdc++-8-dev
libstdc++-8-dev:
  Installed: 8.2.0-1ubuntu2

Upstream gcc has this change to c++config which would fix clang:

/* Define if __float128 is supported on this host. */
#if defined(__FLOAT128__) || defined(__SIZEOF_FLOAT128__)
#define _GLIBCXX_USE_FLOAT128
#endif

https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=260043

    PR libstdc++/84654 Disable __float128 specializations for -mno-float128

    2018-05-01 Tulio Magno Quites Machado Filho <email address hidden>

            PR libstdc++/84654
            * acinclude.m4: Set ENABLE_FLOAT128 instead of _GLIBCXX_USE_FLOAT128.
            * config.h.in: Remove references to _GLIBCXX_USE_FLOAT128.
            * configure: Regenerate.
            * include/Makefile.am: Replace the value of _GLIBCXX_USE_FLOAT128
            based on ENABLE_FLOAT128.
            * include/Makefile.in: Regenerate.
            * include/bits/c++config: Define _GLIBCXX_USE_FLOAT128.
            [!defined(__FLOAT128__) && !defined(__SIZEOF_FLOAT128__)]: Undefine
            _GLIBCXX_USE_FLOAT128.

Revision history for this message
Joel Stanley (shenki) wrote :
Revision history for this message
William J. Schmidt (wschmidt-g) wrote :

In my opinion, the GCC fix should have been proposed for 8.2 (just released), but it appears that it was not. We will work with the community to get it backported for 8.3 in December. Meanwhile, could Ubuntu apply the PR84654 patch for the gcc-8 package?

Revision history for this message
Dimitri John Ledkov (xnox) wrote :

I will ping doko about this.

Usually, the gcc-8 package is updated from the stable branch frequently. Thus landing this on the stable branch, should be sufficient for this to be included in subsequent toolchain uploads.

affects: llvm-defaults (Ubuntu) → gcc-8 (Ubuntu)
Changed in gcc-8 (Ubuntu):
assignee: nobody → Matthias Klose (doko)
Revision history for this message
William J. Schmidt (wschmidt-g) wrote :

Tulio pointed out to me that we also need the fix for https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85672, which is caused by the fix for PR84654.

Revision history for this message
William J. Schmidt (wschmidt-g) wrote :

Thanks, xnox, we will work to get those two patches upstream then. Much obliged!

Revision history for this message
William J. Schmidt (wschmidt-g) wrote :

FYI, Jonathan Wakely has now backported both fixes to the GCC 8 branch in https://gcc.gnu.org/r263084.

Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package gcc-8 - 8.2.0-4ubuntu1

---------------
gcc-8 (8.2.0-4ubuntu1) cosmic; urgency=medium

  * Merge with Debian; remaining changes:
    - Build from upstream sources.

gcc-8 (8.2.0-4) unstable; urgency=medium

  * Update to SVN 20180814 (r263527) from the gcc-8-branch.
    - Fix PR libstdc++/86597, PR libstdc++/84535, PR libstdc++/60555,
      PR libstdc++/86874, PR libstdc++/86861, PR target/86386 (x86),
      PR c++/86728, PR c++/86767, PR fortran/86906.

  [ Nicolas Boulenguez ]
  * gnat: set ld_library_path for tested gnat tools.
  * In the gnat autopkg test, tell gnatmake to report progress on stdout.
  * gnat: Improve the ada-gcc-name patch.
  * Update ada/debian_packaging.mk.

 -- Matthias Klose <email address hidden> Tue, 14 Aug 2018 13:15:46 +0200

Changed in gcc-8 (Ubuntu):
status: New → Fix Released
Revision history for this message
Łukasz Zemczak (sil2100) wrote : Please test proposed package

Hello Joel, or anyone else affected,

Accepted gcc-8 into bionic-proposed. The package will build now and be available at https://launchpad.net/ubuntu/+source/gcc-8/8.3.0-4ubuntu1~18.04 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation on how to enable and use -proposed. Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested and change the tag from verification-needed-bionic to verification-done-bionic. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed-bionic. In either case, without details of your testing we will not be able to proceed.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance for helping!

N.B. The updated package will be released to -updates after the bug(s) fixed by this package have been verified and the package has been in -proposed for a minimum of 7 days.

Changed in gcc-8 (Ubuntu Bionic):
status: New → Fix Committed
tags: added: verification-needed verification-needed-bionic
Revision history for this message
Launchpad Janitor (janitor) wrote :
Download full text (21.4 KiB)

This bug was fixed in the package gcc-8 - 8.3.0-6ubuntu1~18.04

---------------
gcc-8 (8.3.0-6ubuntu1~18.04) bionic-proposed; urgency=medium

  * SRU: LP: #1814369.
  * Update to the GCC 8.3.0 release.
  * Don't build from the ARM/Linaro branch on armhf/arm64.

gcc-8 (8.3.0-6ubuntu1) disco; urgency=medium

  * Merge with Debian; remaining changes:
    - Build from upstream sources.
    - Don't built common libraries now build from GCC 9.

gcc-8 (8.3.0-6) unstable; urgency=medium

  * Update to SVN 20190406 (r270182) from the gcc-8-branch.
    - Fix PR middle-end/89934, PR lto/89896.
  * Fix PR fortran/89981, taken from the trunk.

gcc-8 (8.3.0-5ubuntu1) disco; urgency=medium

  * Merge with Debian; remaining changes:
    - Build from upstream sources.
    - Don't built common libraries now build from GCC 9.

gcc-8 (8.3.0-5) unstable; urgency=medium

  * Update to SVN 20190403 (r270110) from the gcc-8-branch.
    - Fix PR target/89902 (x86), PR target/89903 (x86),
      PR rtl-optimization/89862, PR target/89848 (x86), PR web/87829,
      PR target/89827 (x86), PR fortran/83515, PR fortran/85797,
      PR fortran/78865.
  * Revert the fix for PC c++/88419, causing PR c++/89906. Closes: #926234.
  * Mark gcc-8-source as M-A: foreign.

gcc-8 (8.3.0-4ubuntu1) disco; urgency=medium

  * Merge with Debian; remaining changes:
    - Build from upstream sources.
    - Don't built common libraries now build from GCC 9.

gcc-8 (8.3.0-4) unstable; urgency=medium

  * Update to SVN 20190326 (r269936) from the gcc-8-branch.
    - Fix PR tree-optimization/89546, PR target/89523 (x86), PR fortran/84394,
      PR fortran/66089, PR fortran/66695, PR fortran/77746, PR fortran/79485,
      PR libgcc/60790, PR target/89775 (S390), PR debug/88389,
      PR rtl-optimization/89753, PR middle-end/88273, PR fortran/71861,
      PR fortran/68009.
  * gcc-8-base: Breaks gnat-6 (<< 6.4) to ease upgrades. Closes: #924911.
  * Fix cross building gdc (Helmut Grohne). Closes: #925040.
  * Fix package descriptions for cross packages.
  * Fix PR jit/87808: Don't rely on the gcc driver. Let libgccjit0
    depend on binutils and libgcc-dev. Closes: #911668.
  * Fix stripping the gcc-hppa64 package.

gcc-8 (8.3.0-3ubuntu1) disco; urgency=medium

  * Merge with Debian; remaining changes:
    - Build from upstream sources.
    - Don't built common libraries now build from GCC 9.

gcc-8 (8.3.0-3) unstable; urgency=medium

  * Update to SVN 20190316 (r269720) from the gcc-8-branch.
    - Fix PR tree-optimization/89505, PR target/89517 (AArch64),
      PR bootstrap/89539, PR debug/88878, PR debug/89514,
      PR tree-optimization/89536, PR target/88100 (PPC), PR target/89397 (x86),
      PR target/89361 (S390), PR c++/89212, PR fortran/89077,
      PR fortran/77583, PR fortran/89174, PR fortran/87689, PR fortran/84387,
      PR fortran/89516, PR fortran/89492, PR fortran/89266, PR fortran/88326,
      PR libfortran/89020, PR target/88530 (AArch64), PR target/88530 (AArch64),
      PR ipa/88235, PR c++/88820, PR c++/88869, PR c++/88419, PR c++/88690,
      PR c++/87921, PR c++/89381, PR c++/89576, PR c++/89422, PR c++/87513,
      PR c++/88183, PR c++/89585, PR fortran/71544, PR fortra...

Changed in gcc-8 (Ubuntu Bionic):
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.