-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Widespread error: implicit conversion loses integer precision: '__u64' (aka 'unsigned long long') to '__u32' (aka 'unsigned int') [-Werror,-Wshorten-64-to-32]" subsys=datapath-loader when compiling with Clang 19 #35162
Copy link
Copy link
Closed
Labels
area/datapathImpacts bpf/ or low-level forwarding details, including map management and monitor messages.Impacts bpf/ or low-level forwarding details, including map management and monitor messages.area/llvmRequires upstream work in LLVM.Requires upstream work in LLVM.kind/community-reportThis was reported by a user in the Cilium community, eg via Slack.This was reported by a user in the Cilium community, eg via Slack.kind/enhancementThis would improve or streamline existing functionality.This would improve or streamline existing functionality.
Description
Is there an existing issue for this?
- I have searched the existing issues
Version
equal or higher than v1.16.0 and lower than v1.17.0
What happened?
Clang 19 introduced:
The -Wshorten-64-to-32 diagnostic is now grouped under -Wimplicit-int-conversion instead
of -Wconversion. Fixes #GH69444.
which causes the current code to fail compilation with the flags currently in use.
How can we reproduce the issue?
Run tests on a system with Clang 19 installed, such as running make -C bpf/tests all, but this also affects unit tests like:
=== RUN TestCompile
=== RUN TestCompile/obj:bpf_lxc.o
time="2024-10-01T22:39:35Z" level=error msg="Failed to compile bpf_lxc.o: exit status 1" compiler-pid=66176 subsys=datapath-loader
time="2024-10-01T22:39:35Z" level=warning msg="In file included from ../../../bpf/bpf_lxc.c:20:" subsys=datapath-loader
time="2024-10-01T22:39:35Z" level=warning msg="In file included from ../../../bpf/lib/auth.h:7:" subsys=datapath-loader
time="2024-10-01T22:39:35Z" level=warning msg="../../../bpf/lib/common.h:202:22: error: implicit conversion loses integer precision: 'const __u64' (aka 'const unsigned long long') to '__u32' (aka 'unsigned int') [-Werror,-Wshorten-64-to-32]" subsys=datapath-loader
time="2024-10-01T22:39:35Z" level=warning msg=" 202 | ctx_pull_data(ctx, tot_len);" subsys=datapath-loader
time="2024-10-01T22:39:35Z" level=warning msg=" | ~~~~~~~~~~~~~ ^~~~~~~" subsys=datapath-loader
time="2024-10-01T22:39:35Z" level=warning msg="In file included from ../../../bpf/bpf_lxc.c:20:" subsys=datapath-loader
Cilium Version
1.16.2
Kernel Version
N/A
Kubernetes Version
N/a
Regression
No response
Sysdump
No response
Relevant log output
No response
Anything else?
Regardless how we handle this, we should publish the "highest tested" clang version, instead of a broad "clang+LLVM >= 10.0".
Cilium Users Document
- Are you a user of Cilium? Please add yourself to the Users doc
Code of Conduct
- I agree to follow this project's Code of Conduct
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
area/datapathImpacts bpf/ or low-level forwarding details, including map management and monitor messages.Impacts bpf/ or low-level forwarding details, including map management and monitor messages.area/llvmRequires upstream work in LLVM.Requires upstream work in LLVM.kind/community-reportThis was reported by a user in the Cilium community, eg via Slack.This was reported by a user in the Cilium community, eg via Slack.kind/enhancementThis would improve or streamline existing functionality.This would improve or streamline existing functionality.