Skip to content

Build failure with -Werror=lto-type-mismatch (LTO)  #4128

@orlitzky

Description

@orlitzky

This was reported on Gentoo at https://bugs.gentoo.org/878987, and I've verified that it still happens with the latest v0.3.23.

The -Wlto-type-mismatch flag warns about type mismatches in global declarations from different compilation units. The "lto" part is because those mismatches are dangerous in the presence of LTO, and the warnings are enabled by default with -flto. Adding -Werror=lto-type-mismatch moreover turns them into errors, so that said code cannot sneak into an LTO build. To reproduce, set CFLAGS="-flto -Werror=lto-type-mismatch" and build OpenBLAS.

For background, on Gentoo, users are likely to set CFLAGS="-flto" globally and then add CFLAGS+=" -Werror=lto-type-mismatch" as a safety net against miscompiled packages. On such a machine OpenBLAS will fail to build. As one of the maintainers, I could disable LTO wholesale, but of course it would be preferable (if not to difficult) to just fix the mismatches.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions