Bug 1538817 - g++ fails to compile libcxx on ppc64: error: ‘(9.223372036854775807e+18 / 1.0e+9)’ is not a constant expression
Summary: g++ fails to compile libcxx on ppc64: error: ‘(9.223372036854775807e+18 / 1.0...
Status: NEW
Alias: None
Product: Fedora
Classification: Fedora
Component: gcc
Version: 30
Hardware: ppc64le
OS: Linux
Target Milestone: ---
Assignee: Jakub Jelinek
QA Contact: Fedora Extras Quality Assurance
Keywords: Reopened
Depends On:
Blocks: PPCTracker
TreeView+ depends on / blocked
Reported: 2018-01-25 21:54 UTC by Tom Stellard
Modified: 2019-06-10 21:34 UTC (History)
15 users (show)

Clone Of:
Last Closed: 2018-11-30 23:39:00 UTC

Attachments (Terms of Use)
Preprocesed C++ File (1.06 MB, text/plain)
2018-01-25 21:54 UTC, Tom Stellard
no flags Details

External Trackers
Tracker ID Priority Status Summary Last Updated
GNU Compiler Collection 88204 None None None 2019-06-18 13:27 UTC
IBM Linux Technology Center 173350 None None None 2019-06-18 13:27 UTC

Description Tom Stellard 2018-01-25 21:54:17 UTC
Created attachment 1386322 [details]
Preprocesed C++ File

Description of problem:
The attached reprocessed c++ file fails to compile on ppc64 and ppc64le, but it does compile successfully on x86_64.

Version-Release number of selected component (if applicable):

How reproducible:

Steps to Reproduce:
1. c++ condition_variable.i

Actual results:
In file included from /root/libcxx/include/__mutex_base:15:0,
                 from /root/libcxx/include/condition_variable:111,
                 from ../src/condition_variable.cpp:14:
/root/libcxx/include/chrono: In function ‘void std::__1::this_thread::sleep_for(const std::__1::chrono::duration<_Rep, _Period>&)’:
/root/libcxx/include/thread:438:65:   in constexpr expansion of ‘std::__1::chrono::duration<long double>(std::__1::chrono::duration<long long int, std::__1::ratio<1, 1000000000> >::max(), 0)’
/root/libcxx/include/chrono:563:67:   in constexpr expansion of ‘std::__1::chrono::duration_cast<std::__1::chrono::duration<long double>, long long int, std::__1::ratio<1, 1000000000> >(__d)’
/root/libcxx/include/chrono:415:67:   in constexpr expansion of ‘std::__1::chrono::__duration_cast<std::__1::chrono::duration<long long int, std::__1::ratio<1, 1000000000> >, std::__1::chrono::duration<long double>, std::__1::ratio<1, 1000000000>, true, false>().std::__1::chrono::__duration_cast<std::__1::chrono::duration<long long int, std::__1::ratio<1, 1000000000> >, std::__1::chrono::duration<long double>, std::__1::ratio<1, 1000000000>, true, false>::operator()(__fd)’
/root/libcxx/include/chrono:376:59: error: ‘(9.223372036854775807e+18 / 1.0e+9)’ is not a constant expression
                            static_cast<_Ct>(__fd.count()) / static_cast<_Ct>(_Period::den)));

Expected results:
File compiles successfully.

Comment 1 Jakub Jelinek 2018-01-26 20:38:13 UTC
The IBM long double format is too weird and not everything in it is possible to be evaluated at compile time.

Comment 2 Tom Stellard 2018-01-26 20:41:00 UTC
So is my best option to  modify the source to not use constexpr on ppc?

Comment 3 Tom Stellard 2018-01-26 20:41:49 UTC
I also should have mentioned that this compiles fine with clang.

Comment 4 dxm480 2018-07-30 10:22:51 UTC
@Jakub - what about (9.223372036854775807e+18 / 1.0e+9) is not possible to evaluate at compile time in IBM long double format? I agree that it's an abomination but the unfortunate reality is there will be systems out there with IBM long-double ABI libraries for decades to come. :(

@Tom: one potential workaround is to use IEEE754 standard long double format, e.g. build with "-mabi=ieeelongdouble", but now you're using a different ABI, which may or may not be what you want. It is probably easier to just avoid using constexpr when building with the GCC+PPC combination.

Comment 5 Dan Horák 2018-09-05 21:29:51 UTC
same problem with gcc-8.1.1-5.fc28.ppc64le

Comment 6 Bill Schmidt 2018-09-12 20:31:02 UTC
(In reply to Tom Stellard from comment #2)
> So is my best option to  modify the source to not use constexpr on ppc?


Bill Schmidt, Ph.D.
GCC Architect for Linux on Power
IBM Linux Technology Center

Comment 7 Jeffrey Walton 2018-11-17 01:17:50 UTC
Also see https://bugs.llvm.org/show_bug.cgi?id=39696 . This issue blocks LLVM from building on GCC112 on the compile farm.

(There may be additional build problems).

Comment 8 Ben Cotton 2018-11-27 13:32:30 UTC
This message is a reminder that Fedora 27 is nearing its end of life.
On 2018-Nov-30  Fedora will stop maintaining and issuing updates for
Fedora 27. It is Fedora's policy to close all bug reports from releases
that are no longer maintained. At that time this bug will be closed as
EOL if it remains open with a Fedora  'version' of '27'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora 27 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora, you are encouraged  change the 'version' to a later Fedora 
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events. Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

Comment 9 Ben Cotton 2018-11-30 23:39:00 UTC
Fedora 27 changed to end-of-life (EOL) status on 2018-11-30. Fedora 27 is
no longer maintained, which means that it will not receive any further
security or bug fix updates. As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of
Fedora please feel free to reopen this bug against that version. If you
are unable to reopen this bug, please file a new report against the
current release. If you experience problems, please add a comment to this

Thank you for reporting this bug and we are sorry it could not be fixed.

Comment 10 Ben Cotton 2019-02-19 17:12:14 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 30 development cycle.
Changing version to '30.

Note You need to log in before you can comment on or make changes to this bug.