PowerPC: `interval<long double>` with constant operands fails to compile with GCC
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 66/100
Research direction
Start with boost/numeric/interval/detail/ppc_rounding_control.hpp at the force_rounding asm described in the issue, then compile the supplied reproducer on ppc64le with GCC using -O2 -frounding-math. The issue proposes separate output and matching input operands; check that constant operands compile and non-constant operands keep the same generated code. Done means the reproducer compiles and prints 3 3.
Written by the indexing model from the issue text.
Description
On ppc64le, GCC rejects the long double force_rounding asm in detail/ppc_rounding_control.hpp when the value reaching it is a constant:
#include <boost/numeric/interval.hpp>
#include <iostream>
typedef boost::numeric::interval<long double> I;
I half_of_six() { return I(6) / I(2); }
int main() {
I q = half_of_six();
std::cout << q.lower() << ' ' << q.upper() << '\n'; // 3 3
}
$ g++ -O2 -frounding-math repro.cpp
boost/numeric/interval/detail/ppc_rounding_control.hpp:110:5: error: impossible constraint in 'asm'
After inlining, the folded quotient reaches __asm__ __volatile__ ("" : "+wa,d,m"(r_)) as a constant, and GCC cannot satisfy an in-out operand that has several alternatives. Giving the output and a matching input separately, "=wa,d,m"(r_) : "0,0,0"(r_), keeps the same alternatives and generates the same code for non-constant operands, and GCC accepts it.
This was introduced in #53, so no release is affected yet, but it is on master and would ship in 1.93. Releases up to 1.92 cannot show it: there ppc_rounding_control.hpp does not compile in C++11 and later (narrowing in rounding_mode_struct, fixed by eb65dcd).
- Dominant language
- C++
- Stars
- 31
- Forks
- 49
- Avg merge
- 1d 4h
- Merged PRs (30d)
- 9
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from boostorg/interval
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Maintainers usually reply within 1 day
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
boostorg/interval#44 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 5/5 Over a week Newbie friendliness 10/100
Maintainers usually reply within 1 day
-
Code behaves differently if compiled with MSVC vs GCCPossibly taken @reach2sayan claimed this 9 days ago. Open
Difficulty 5/5 Over a week Newbie friendliness 25/100
boostorg/interval#35 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 45/100
Maintainers usually reply within 1 day
All issues in boostorg/interval
Similar issues
-
backlog
Difficulty 1/5 Under an hour Newbie friendliness 91/100
EchoTools/nevr-runtime#1108 ·
Maintainers usually reply within 1 day
-
Status: Needs confirmation Status: Needs triage
Difficulty 2/5 1-3 hours Newbie friendliness 64/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
boykopovar/AnyPS5#12124 ·
Maintainers usually reply within 1 day
-
bug-unconfirmed
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
Maintainers usually reply within 1 day
-
A-combat P-low S-ready-to-start task
Difficulty 2/5 1-3 hours Newbie friendliness 77/100
Maintainers usually reply within 1 day