Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

PowerPC: `interval<long double>` with constant operands fails to compile with GCC

Open Beginner friendly
#66 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
66/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
cpp
Domain
backend

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

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from boostorg/interval

All issues in boostorg/interval

Similar issues

More C++ issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.