PowerPC: `interval<long double>` with constant operands fails to compile with GCC
维护者通常 1 天内回复
评估
调研方向
从 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,通用步骤见我们的新手贡献指南。
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
boostorg/interval 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 76/100
维护者通常 1 天内回复
-
难度 4/5 3-5 天 新手友好度 35/100
boostorg/interval#44 · 1 条评论 ·
维护者通常 1 天内回复
-
难度 5/5 一周以上 新手友好度 10/100
维护者通常 1 天内回复
-
Code behaves differently if compiled with MSVC vs GCC可能已有人在做 @reach2sayan 于 10 天前认领。 未关闭
难度 5/5 一周以上 新手友好度 25/100
boostorg/interval#35 · 1 条评论 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 45/100
维护者通常 1 天内回复
查看 boostorg/interval 的全部 Issue
相似的 Issue
-
bug priority: low
难度 2/5 1-3 小时 新手友好度 68/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 86/100
chipsalliance/verible#2644 ·
-
难度 2/5 1-3 小时 新手友好度 74/100
grafana/pyroscope-dotnet#470 ·
维护者通常 1 天内回复
-
documentation P5 XS
难度 2/5 1-3 小时 新手友好度 72/100
open-astro/AlpacaBridge#1848 ·
维护者通常 1 天内回复
-
DiskANN AnnIterator returns unconverted IP distances after the graph walk runs out of candidates未关闭
难度 2/5 1-3 小时 新手友好度 75/100
zilliztech/knowhere#1933 ·
维护者通常 1 天内回复