OpenMathLib / OpenMathLib/OpenBLAS

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

Open
#4,128 13 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C
Stars
7.6k
Forks
1.7k
Avg merge
1d 3h
Merged PRs (30d)
42

Description

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.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the OpenBLAS build with CFLAGS="-flto -Werror=lto-type-mismatch" as described in the issue, then inspect the compiler diagnostics for mismatched global declarations across compilation units. Trace each reported declaration to the relevant C sources and verify that the build succeeds with the flags once the mismatches are resolved.

Written by the indexing model from the issue text.

Assessment

Tech stack
c
Domain
build-system, hpc, performance
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.