GCC 13.3.0 miscompiles LLVM(你们不要再打了啦!)

来自我们的老朋友宋教授的博客:

For years, I’ve been involved in updating LLVM’s MC layer. A recentjourney led me to eliminate the FK_PCRel_ fixup kinds.

MCFixup: Remove FK_PCRel_The generic FK_Data_ fixup kinds handle both absolute and PC-relativefixups. ELFObjectWriter sets IsPCRel to true for `.long foo-.`, so thebackend has to handle PC-relative FK_Data_.However, the existence of FK_PCRel_ encouraged backends to implement itas a separate fixup type, leading to redundant and error-prone code.Removing FK_PCRel_ simplifies the overall fixup mechanism.

As a prerequisite, I had to update several backends that relied onthe now-deleted fixup kinds. It was during this process that somethingunexpected happened. Contributors reportedthat when built by GCC 13.3.0, the LLVM integrated assembler hadtest failures.

2 个赞

I’ve said it before and I’ll say it again: trusting -O3 is like trusting a toddler with scissors. Sure, maybe they make something pretty. Or maybe they destroy your entire project and pretend it was intentional.

5 个赞

看完此帖,默默地把我的openwrt固件编译参数里的Ofast改回了O2

不是吧, Ofast ?

O3 编译坏还可以说是编译器学艺不精

Ofast 编译坏就纯属自找的(

在我的使用场景中,没有测出明显的区别。开Ofast未见有显著的性能提升(其实就是配置文件懒得改)。在openwrt中开和不开的区别只有固件大小是否更大

1 个赞

Ofast 开的那些优化,只能说性能提升不好说,但正确性保证反正是放弃了的(

2 个赞