-
Notifications
You must be signed in to change notification settings - Fork 7.7k
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
Overflow error with gcc 14.1 and LTO #1642
Comments
It's not a real bug; |
Can you try replacing 5156:
with
and see if the warning goes away? |
no luck with either that change, setting the struct to 4 or "s->img_n != 1 && s->img_n != 3" |
by "the struct" do you mean the variable "tc"? |
Anyway, if so, I have no idea what the warning is. Indeed, if |
Are you loading an image from a file, or is it stored in a big array in C++ code? |
There was a similar issue reported in gcc 12.2 that doesn't seem to have been fixed, potentially the same issue. https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106757 Are you compiling -O2 or -O3? |
After your comments, this definitely is a gcc bug as the logic looks correct, yet any new bounds check doesn't help (I tried several) compiling with 03 and it only complains in the LTO stage, not the initial file compile. I'm loading an image from a memory buffer 2 different fixes, but the 1st allows vectorization
|
But how is the image getting to the memory buffer? Is it available in the C++ code (is the optimizer able to see the actual image data being used? if so maybe there's a real bug) or is it coming from a source at runtime like being loaded from a file (so, no, the optimizer doesn't know what the actual data is). |
I've been compiling with:
Not ideal as it seems to imply |
It definitely looks like a GCC bug. No bounds check changes are needed if |
What if you move the assignment of has_trans=1 to after the tc[]-assigning loop, at the end of the else clause (after both of the tc[]-assigning loops, i.e. at the same indent level it is currently) |
Same compiler error. |
the image is read in from the filesystem so not available to the compiler. I compiled close to 300 opensource components with gcc14 and this is the first analyzer error I found - though I did notice what seemed like more bogus stringop overflow warnings relative to 13.2 |
Same issue in this project here: https://github.com/ggerganov/llama.cpp Related report: ggerganov/llama.cpp#7431 |
Same issue seen in SDL_image: libsdl-org/SDL_image#453 |
I've released stb_image 2.30 with just the fix suggested by @EvilPudding. Let me know if it's not fixed. |
It fixes the warning for us in SDL_image. |
I upgraded from GCC 13.2 to GCC 14.1 and am now seeing an error in STB during LTO optimization. This does not happen with debug builds, but I've noticed on other code that GCC 14 has found a couple legit bugs previous versions did not. My STB use is trivial as it is just a single object use to pass into ZXing-cpp QR reader
I tried updating to the absolute latest git source and no difference (was < 10 revs back)
The text was updated successfully, but these errors were encountered: