在aarch64平台用GCC9.3/9.4编译CPU2017的510.parest_r失败求助
问题:AArch64架构下GCC9.x编译SPEC CPU2017 510.parest_r触发MPFR断言失败
环境与现象
- 架构:AArch64
- 编译器:GCC9.3/GCC9.4(均触发相同错误)
- 测试集:SPEC CPU2017 intrate/fprate
- 问题:仅510.parest_r编译失败,其余基准测试编译成功
- 配置:使用Example-gcc-linux-aarch64.cfg,仅修改GCC路径
- 验证情况:LLVM-10可成功编译该用例;x86_64架构下用相同GCC9.3编译无异常
编译报错信息
/home/gcc9.3/bin/g++ -std=c++03 -mabi=lp64 -c -o source/me-tomography/synthetic_data.o -DSPEC -DNDEBUG -Iinclude -I. -DSPEC_AUTO_SUPPRESS_OPENMP -O3 -DSPEC_LP64 source/me-tomography/synthetic_data.cc /home/gcc9.3/bin/g++ -std=c++03 -mabi=lp64 -c -o source/multigrid/mg_base.o -DSPEC -DNDEBUG -Iinclude -I. -DSPEC_AUTO_SUPPRESS_OPENMP -O3 -DSPEC_LP64 source/multigrid/mg_base.cc /home/gcc9.3/bin/g++ -std=c++03 -mabi=lp64 -c -o source/me-tomography/measurements.o -DSPEC -DNDEBUG -Iinclude -I. -DSPEC_AUTO_SUPPRESS_OPENMP -O3 -DSPEC_LP64 source/me-tomography/measurements.cc init2.c:52: MPFR assertion failed: p >= 2 && p <= ((mpfr_prec_t)((mpfr_uprec_t)(~(mpfr_uprec_t)0)>>1)) during GIMPLE pass: forwprop source/me-tomography/measurements.cc: In constructor 'METomography::Measurements::ReferencedMeasurements::RatioMinusRatio<dim, number>::RatioMinusRatio(const libparest::Slave::Stationary::ProblemDescription&, const dealii::Function<dim>&, const std::set<unsigned char>&) [with int dim = 3; number = double]': source/me-tomography/measurements.cc:1739:7: internal compiler error: Aborted 1739 | RatioMinusRatio<dim,number>:: | ^~~~~~~~~~~~~~~~~~~~~~~~~~~ 0xafbd97 crash_signal ../.././gcc/toplev.c:326 0xffff9e304d78 __GI_raise ../sysdeps/unix/sysv/linux/raise.c:51 0xffff9e2f1aab __GI_abort /build/glibc-RIFKjK/glibc-2.31/stdlib/abort.c:79 Please submit a full bug report, with preprocessed source if appropriate. Please include the complete backtrace with any bug report. See <https://gcc.gnu.org/bugs/> for instructions. specmake: *** [/home/spec/cpu2017_aarch64/benchspec/Makefile.defaults:356: source/me-tomography/measurements.o] Error 1 specmake: *** Waiting for unfinished jobs....
原因分析
报错显示GCC在forwprop优化阶段触发MPFR库的断言失败,这是GCC9.x版本在AArch64架构下的特定优化bug,和浮点精度参数的架构相关处理逻辑有关。x86_64架构无此问题,说明是AArch64后端的优化实现缺陷。
解决方案建议
- 降低优化等级:针对510.parest_r单独修改编译选项,用
-O2替代-O3,可绕过触发问题的高等级优化逻辑 - 禁用特定优化pass:添加编译参数
-fno-forwprop,跳过导致断言失败的forwprop优化阶段 - 升级编译器版本:将GCC升级到10.x及以上版本,这类架构特定的优化bug通常在后续版本中被修复
- 替换编译器:继续使用LLVM-10编译510.parest_r,其余用例保持GCC编译,不影响整体测试流程
内容的提问来源于stack exchange,提问作者Li ST
相关产品推荐
相关产品推荐

