Bug 1538817

Summary: g++ fails to compile libcxx on ppc64: error: ‘(9.223372036854775807e+18 / 1.0e+9)’ is not a constant expression
Product: [Fedora] Fedora Reporter: Tom Stellard <tstellar>
Component: gccAssignee: Jakub Jelinek <jakub>
Status: CLOSED RAWHIDE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 30CC: bugproxy, dan, davejohansen, dcantrell, dxm480, fweimer, hannsj_uhl, itaru.kitayama, jakub, jwakely, law, mpolacek, noloader, normand, wschmidt
Target Milestone: ---Keywords: Reopened
Target Release: ---   
Hardware: ppc64le   
OS: Linux   
Whiteboard:
Fixed In Version: gcc-9.2.1-1.fc32.3 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-01-16 02:25:05 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1071880    
Attachments:
Description Flags
Preprocesed C++ File none

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):
gcc-7.2.1-2.fc27

How reproducible:
Always


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?

Yes.

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

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
bug.

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.

Comment 11 Tom Stellard 2020-01-16 02:25:05 UTC
This is working now with gcc-9.2.1-1.fc32.3.

Comment 12 Jeffrey Walton 2020-01-16 03:12:07 UTC
(In reply to Tom Stellard from comment #11)
> This is working now with gcc-9.2.1-1.fc32.3.

Thanks Tom.