Skip to content

Commit 0aa502a

Browse files
committed
Disable null-pointer check optimization in gcc
In certain situations, gcc will remove instances of code that check if a pointer is null, if it thinks that the pointer can never be null. However, many of these pointers *can* be null in TF2, so this optimization can cause crashes.
1 parent 3f650ad commit 0aa502a

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

src/devtools/makefile_base_posix.mak

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ ifeq ($(CFG), release)
5757
# tonyp: The size increase was likely caused by -finline-functions and -fipa-cp-clone getting switched on with -O3.
5858
# -fno-omit-frame-pointer: need this for stack traces with perf.
5959
OptimizerLevel_CompilerSpecific = -O2 -fno-strict-aliasing -ffast-math -fno-omit-frame-pointer -ftree-vectorize
60+
OptimizerLevel_CompilerSpecific += -fno-delete-null-pointer-checks
6061
ifeq ($(CLANG_BUILD),1)
6162
OptimizerLevel_CompilerSpecific += -funswitch-loops
6263
else

0 commit comments

Comments
 (0)