-
Notifications
You must be signed in to change notification settings - Fork 528
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bug 5160: Compile fails with -flto=auto [-Walloc-size-larger-than=] #1118
base: master
Are you sure you want to change the base?
Bug 5160: Compile fails with -flto=auto [-Walloc-size-larger-than=] #1118
Conversation
GCC 12 emits an error when compiling squid due to -Werror=alloc-size-larger-than. The error looks like this: store/Disks.cc:690:64: error: argument 1 value '18446744073709551615' exceeds maximum object size 9223372036854775807 [-Werror=alloc-size-larger-than=] 690 | const auto tmp = new SwapDir::Pointer[swap->n_allocated]; | ^ Arguably, this is likely a compiler bug and not squid's fault. Either way, I believe it's worth having more type safety in this code. Signed-off-by: Sergio Durigan Junior <[email protected]>
Can one of the admins verify this patch? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Interesting error! Thank you for trying to improve Squid code while working around alleged GCC bugs.
-Werror=alloc-size-larger-than
on GCC 12
is this still under work/consideration? I am getting this error when compiling squid for tls inspection on ubuntu-24.04 (debian package rebuild) as per https://github.com/juju4/ansible-squid/actions/runs/10429779309/job/28887616336#step:8:1 Thanks |
We still want to improve warning-related code, but it looks like nobody is working on that right now. If you can post an alternative PR (that takes my review concerns into consideration), please do so. |
FYI; Please check whether you are building with LTO support enabled by default. This |
On https://github.com/juju4/ansible-squid/actions/runs/11621187815/job/32364459556, I can see compilation arguments "-flto=auto -ffat-lto-objects" but no other clear logs match. Outside of enabling openssl, the rest of the options are part of default debian package. |
Okay, that is the known LTO bug. Thank you for working on it. I will adjust the title appropriately. |
What's the impact of disabling LTO? how to do it? no such option in |
... and all side effect changes resulting.
OK to test |
@juju4, I will try to answer your questions, but LTO is not my area of expertise:
The exact full impact of building with or without LTO is unknown (to me). As earlier Bug 5160 work indicates, LTO may trigger1 runtime problems without breaking Squid compilation. LTO is also suspected of breaking compilation (this PR and yours). I do not know why.
I do not know and failed to find a good answer by glancing through
Correct: Squid is currently unaware of LTO. Compiler is free to enable it (where LTO does not contradict other compiler settings). To control LTO, one should manipulate compiler flags directly. It may be possible to disable LTO as a side effect of using Footnotes
|
Confirming that building without LTO is successful on Ubuntu 24.04 as per https://github.com/juju4/ansible-squid/actions/runs/11669115650/job/32490348166#step:8:532 but fails for 22.04 or earlier On LTO, mostly from gcc docs and stackoverflow and matching the "introduced subtle bugs" |
FWIW, that build log shows |
I adjusted PR description to fix formatting, to add the second known error to the "errors" list, and to restore the original "likely a compiler bug" speculation. |
When building with LTO support (
-flto=auto -ffat-lto-objects
)the following errors occur:
store/Disks.cc:690: error: argument 1 value 18446744073709551615
exceeds maximum object size 9223372036854775807
[-Werror=alloc-size-larger-than=]
const auto tmp = new SwapDir::Pointer[swap->n_allocated];
pconn.cc:43:53: error: argument 1 value 18446744073709551615
exceeds maximum object size 9223372036854775807
[-Werror=alloc-size-larger-than=]
theList_ = new Comm::ConnectionPointer[capacity_];
Arguably, this is likely a compiler bug and not squid's fault. Either
way, it's worth having more type safety in this code.