dhewm3-sdk/sys
Daniel Gibson ba6ba086b2 Don't use GCC's __builtin_alloca_with_align(), fix #572
turns out that __builtin_alloca_with_align() might releases the
allocated memory at the end of the block it was allocated in, instead
of the end of the function (which is the behavior of regular alloca()
and __builtin_alloca()): "The lifetime of the allocated object ends at
 the end of the block in which the function was called. The allocated
 storage is released no later than just before the calling function
 returns to its caller, but may be released at the end of the block in
 which the function was called."
https://gcc.gnu.org/onlinedocs/gcc/Other-Builtins.html#index-_005f_005fbuiltin_005falloca_005fwith_005falign

Clang also supports __builtin_alloca_with_align(), but always releases
the memory at the end of the function.

And it seems that newer GCC versions also tend to release it at the
end of the function, but GCC 4.7.2 (that I use for the official Linux
release binaries) didn't, and that caused weird graphical glitches.
But as I don't want to rely on newer GCC versions behaving like this
(and the documentation explicitly says that it *may* be released at
 the end of the block, but will definitely be released at the end of
 the function), I removed all usage of __builtin_alloca_with_align().

(Side-Note: GCC only started documenting the behavior of
 __builtin_alloca and __builtin_alloca_with_align at all with GCC 6.1.0)
2024-04-19 07:39:56 +02:00
..
platform.h Don't use GCC's __builtin_alloca_with_align(), fix #572 2024-04-19 07:39:56 +02:00
Stub_SDL_endian.h From dhewm3: Add absolute mouse mode and refactor mouse grabbing code 2022-05-17 07:17:46 +02:00
sys_public.h merge sys_public.h changes for gamepad support 2024-03-18 23:04:09 +01:00