Skip to content

Commit

Permalink
cflags.SH - add -Wno-use-after-free on gcc 12/13
Browse files Browse the repository at this point in the history
This works around an overly eager/buggy use-after-free warning detection
in gcc 12/13, which gets upset if we copy a pointer into a UV and then
realloc the pointer and then use the UV value for diagnostics. Since the
copied value is no longer a pointer gcc should not warn, as we are not
"using" the pointer, just printing it out as a number. The gcc folks
have been informed. See:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108115

Fixes #20601.
  • Loading branch information
demerphq committed Feb 13, 2023
1 parent 5e2af7a commit 845f95a
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions cflags.SH
Original file line number Diff line number Diff line change
Expand Up @@ -379,6 +379,19 @@ esac
;;
esac

# gcc version 12 and 13 are overly aggressive with use-after-free warnings
# and have false positives on code that shouldn't warn, and they haven't
# sorted it out yet. See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108115
case "$gccversion" in
"1"[23]*)
for f in -Wno-use-after-free
do
echo "cflags.SH: Adding $f because of false positives in gccversion '$gccversion'"
warn="$warn $f"
done
;;
esac

echo "cflags.SH: cc = $cc"
echo "cflags.SH: ccflags = $ccflags"
echo "cflags.SH: stdflags = $stdflags"
Expand Down

0 comments on commit 845f95a

Please sign in to comment.