https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116182
Bug ID: 116182 Summary: bootstrap-lto should set a small list of -Werror options for LTO correctness (-Werror=lto-type-mismatch,odr,strict-aliasing) Product: gcc Version: 15.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: other Assignee: unassigned at gcc dot gnu.org Reporter: sjames at gcc dot gnu.org CC: arsen at gcc dot gnu.org Target Milestone: --- With LTO, we have -Wlto-type-mismatch and -Wodr as powerful ways to find UB which may explode at runtime with LTO especially. In Gentoo, we encourage strongly that if anyone uses LTO, they use -Werror=lto-type-mismatch,odr,strict-aliasing. We hit occasional bootstrap issues where such a warning was missed in GCC itself, e.g. PR108087, PR115917, PR114529, PR116181. I'd suggest we add these 3 as -Werror= to the bootstrap-lto configuration. I think --enable-werror is orthogonal to this because: a) it'll make various bits like unused variables error out; b) the pesky middle-end warnings like -Wstringop-overflow do fire during LTO bootstraps (I know -Wstrict-aliasing is imperfect but IME it's at least good enough in terms of FPs for this.)