Indeed.
We may have initially matched really close to GCC in the past (dragonegg era) to be able to be a drop-in replacement, but that era has long gone. Today entire systems (including kernels) compile with clang on its own, not as a GCC replacement.
We should not shoot ourselves in the foot just because GCC does. That has been a design decision since the beginning in Clang (ex. -heinous-gcc-extensions
et al). And that has made Linux (kernel & system), FreeBSD and other very large projects better because of it.
However, IIUC, -Ofast
is a GCC mnemonic. If we are emulating some user interface from GCC, then we should match the behaviour. In the same case, if we emulate MSVC command-line, we need to match semantics.
We can, however, emit warnings on doing so. We can disable those warnings with something very obvious like -wno-gcc-footgun
or something.
We have explicitly selected out any GCC footgun in the past and we should continue doing that. Any passes that are known to be incorrect or destroy semantics beyond local scope should not be in a -O
option, and should need to be added explicitly.