We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent f40c89e commit 341f676Copy full SHA for 341f676
src/hotspot/os/linux/os_linux.cpp
@@ -672,7 +672,8 @@ static void *thread_native_entry(Thread *thread) {
672
// and we did not see any degradation in performance without `alloca()`.
673
static int counter = 0;
674
int pid = os::current_process_id();
675
- void *stackmem = alloca(((pid ^ counter++) & 7) * 128);
+ int random = ((pid ^ counter++) & 7) * 128;
676
+ void *stackmem = alloca(random != 0 ? random : 1); // ensure we allocate > 0
677
// Ensure the alloca result is used in a way that prevents the compiler from eliding it.
678
*(char *)stackmem = 1;
679
#endif
0 commit comments