Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

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

未关闭 适合新手
#66 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

@reach2sayan 已经在做这个了。

开始于 2026年10月28日。

  • #69 来自 @reach2sayan —— 未关闭

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
66/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
cpp
领域
backend

调研方向

从 boost/numeric/interval/detail/ppc_rounding_control.hpp 中 issue 描述的 force_rounding asm 开始,然后在 ppc64le 上使用 GCC 和 -O2 -frounding-math 编译提供的复现程序。Issue 提议使用单独的输出操作数和匹配的输入操作数;检查常量操作数能否编译,以及非恒定操作数是否保持相同的生成代码。复现程序成功编译并输出 3 3 即为完成。

由索引模型根据 Issue 内容生成。

描述

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

主要语言
C++
星标
31
派生
49
平均合并
1 天 4 小时
30 天内合并 PR
9

环境准备

这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

boostorg/interval 的其他 Issue

查看 boostorg/interval 的全部 Issue

相似的 Issue

更多 C++ Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。