Skip to content

Fix -Wnonnull build failure in TypedStats: value-initialize last_seen_val - #70

Open
z0mz0m wants to merge 1 commit into
cwida:devfrom
Zetta-Zip:fix/typedstats-string-value-init
Open

Fix -Wnonnull build failure in TypedStats: value-initialize last_seen_val#70
z0mz0m wants to merge 1 commit into
cwida:devfrom
Zetta-Zip:fix/typedstats-string-value-init

Conversation

@z0mz0m

@z0mz0m z0mz0m commented Jul 27, 2026

Copy link
Copy Markdown

TypedStats<PT> is explicitly instantiated for every PT in FLS_ALL_CTS, including str_pt. The member initializer last_seen_val(0) therefore instantiates as std::string(0) == std::string(nullptr), which is undefined behaviour. Clang 21 diagnoses it and, with the project's -Werror, the build fails:

src/table/stats.cpp:17:21: error: null passed to a callee that requires a non-null argument [-Werror,-Wnonnull]

Value-initializing with {} yields 0 for the arithmetic instantiations and an empty string for str_pt, so there is no behaviour change for the numeric types.

Reproduced on: macOS 15 / arm64, Apple clang 21, pip install . (scikit-build-core, Release). With this one-line change the wheel builds and a CSV -> .fls -> CSV roundtrip over ~112k rows x 7 BIGINT columns is byte-identical.

🤖 Generated with Claude Code

TypedStats<PT> is explicitly instantiated for every PT in FLS_ALL_CTS,
including str_pt. The member initializer last_seen_val(0) therefore
instantiates as std::string(0) == std::string(nullptr), which is
undefined behaviour; clang 21 diagnoses it as -Wnonnull and the build
fails under -Werror:

  src/table/stats.cpp:17:21: error: null passed to a callee that
  requires a non-null argument [-Werror,-Wnonnull]

Value-initializing instead gives 0 for the arithmetic instantiations
and an empty string for str_pt, with no behaviour change for the
numeric types.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@z0mz0m
z0mz0m force-pushed the fix/typedstats-string-value-init branch from 63e1a56 to 0cb51f8 Compare July 27, 2026 10:22
z0mz0m added a commit to Zetta-Zip/FastLanes that referenced this pull request Jul 27, 2026
TypedStats<PT> is instantiated for str_pt via FLS_ALL_CTS, so
last_seen_val(0) instantiated as std::string(nullptr) — UB, and fatal
under -Werror with clang 21's -Wnonnull. Upstream PR: cwida#70

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant