From: 
Subject: Fix crashes on F19 with optimization an USE_CLONE

Compiler optimization was defeating our detection of the direction of stack
growth. Given that there's no truely portable way to do this, and the clone man
page tells us the only architecture where stack grows up is HP-PA, and we are
unlikely to ever run on linux on hppa, just hardcode this as stack_grows_down.

Origin: upstream, https://htcondor-wiki.cs.wisc.edu/index.cgi/chngview?cn=38936

diff --git a/src/condor_daemon_core.V6/daemon_core.cpp b/src/condor_daemon_core.V6/daemon_core.cpp
index 9d546f564b11eca635d8f1603b772998baa82da5..f80972d7aa7abef3c8cfb581aa855ff681ba79c0 100644
--- a/src/condor_daemon_core.V6/daemon_core.cpp
+++ b/src/condor_daemon_core.V6/daemon_core.cpp
@@ -5407,12 +5407,13 @@ enum {
 };
 
 #if HAVE_CLONE
-static int stack_direction(volatile int *ptr=NULL) {
-    volatile int location;
-    if(!ptr) return stack_direction(&location);
-    if (ptr < &location) {
-        return STACK_GROWS_UP;
-    }
+static int stack_direction() {
+
+// We used to try to be clever about figuring this out
+// but compiler optimizations kept tripping up this code
+// The clone(2) man page says "stack grown down on all
+// Linux supported architectures except HP-PA.
+// So just hardcode STACK_GROWS_DOWN...
 
     return STACK_GROWS_DOWN;
 }
