this post was submitted on 11 Oct 2023
8 points (78.6% liked)
Programming
17313 readers
259 users here now
Welcome to the main community in programming.dev! Feel free to post anything relating to programming here!
Cross posting is strongly encouraged in the instance. If you feel your post or another person's post makes sense in another community cross post into it.
Hope you enjoy the instance!
Rules
Rules
- Follow the programming.dev instance rules
- Keep content related to programming in some way
- If you're posting long videos try to add in some form of tldr for those who don't want to watch videos
Wormhole
Follow the wormhole through a path of communities [email protected]
founded 2 years ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
The code hitting that error is here:
https://git.kernel.org/pub/scm/linux/kernel/git/iwlwifi/iwlwifi-fixes.git/tree/tools/lib/subcmd/subcmd-util.h
It looks fine to me.
What you are seeing is a warning that your compiler may have found a use-after-free bug, but I think this is a false positive. Your build is configured to turn this warning into a hard error.
I think it will be difficult to know how to fix this without knowing more about your build setup. Are you passing any custom CFLAGS? What compiler and version are you using?
Also, here is someone asking about the same issue (in the same code) on Stack Exchange using GGC 12.1:
https://unix.stackexchange.com/questions/709671/linux-kernel-5-15-54-compilation-errors-with-gcc-12-1
This was the top result when Googling
linux "-Werror=use-after-free"
.I believe you can disable this warning in this file by adding a pragma after the includes (line 8):
See https://stackoverflow.com/questions/925179/selectively-remove-a-warning-message-using-gcc
Edit: If you don't want to change the code, try disabling the use-after-free warning from the make call:
make CFLAGS="-Wno-use-after-free" ---> didn't work, same errors
there's no "use-after-free" flag in any Makefile of the repo, no string "use-after-free" either, only the comments
(line 8): #pragma GCC diagnostic ignored "-Wuse-after-free" ---> line 8 of what file? Makefile?
Any idea?
Bummer that the CFLAGS trick didn't work.
use-after-free is a default warning. The makefile has
-Werror
to turn warnings into errors.The C file that I linked to (subcmd-util.h)