Add -flifetime-dse=1 flag to Linux Makefile to disable compiler optimization that removed entity memory zero-initialization

Resolves #187
This commit is contained in:
Sam V 2023-02-02 15:12:57 +01:00
parent 9c4af83c7d
commit ba8089e1f3
2 changed files with 4 additions and 1 deletions

View file

@ -15,6 +15,7 @@
* Removed unnecessary semicolons (Thanks Shepard)
* Updated source file encoding to UTF-8 [#183](https://github.com/SamVanheer/halflife-updated/issues/183) (Thanks anchurcn)
* Renamed `CWorld::Instance` to `CWorld::World` to avoid conflicting with `CBaseEntity::Instance` function name
* Added `-flifetime-dse=1` flag to Linux Makefile to disable compiler optimization that removed entity memory zero-initialization, resulting in the game crashing when any entity touches the world [#187](https://github.com/SamVanheer/halflife-updated/issues/187)(Thanks FreeSlave)
## Changes in V1.0.0 Beta 013

View file

@ -39,7 +39,9 @@ else
ARCH_CFLAGS+=-gdwarf-2 -g2
endif
BASE_CFLAGS=-std=c++17 -fpermissive -fno-strict-aliasing -fno-exceptions -fexpensive-optimizations -Werror=return-type -w
# flifetime-dse=1 is needed to disable a compiler optimization that optimizes out std::memset calls in CBaseEntity::operator new
# See https://gcc.gnu.org/onlinedocs/gcc/Optimize-Options.html#index-flifetime-dse for more information about the flifetime-dse flag
BASE_CFLAGS=-std=c++17 -fpermissive -fno-strict-aliasing -fno-exceptions -fexpensive-optimizations -Werror=return-type -w -flifetime-dse=1
BASE_CFLAGS+=-DNDEBUG -DPOSIX -D_POSIX -DLINUX -D_LINUX -DGNUC -DNO_MALLOC_OVERRIDE -DCLIENT_WEAPONS
SHLIBEXT=so