On Tue, Jan 14, 2020 at 03:02:01PM -0700, Jeff Law wrote:
> Bootstrapped and regression tested on x86_64. Verified STACK_DIRECTION
> is correct via hand inspection.
>
> OK for the trunk?
Wouldn't that fail due to warnings if compiled e.g. by gcc that doesn't
support noclone attribute?
Can't we e.g. instead do
int (*volatile fn) ();
fn = find_stack_direction;
return fn ();
instead of
return find_stack_direction ();
when performing the recursive call?
Though, at least current trunk emits tons of warnings on it already, so
maybe it must ignore warnings already.
> diff --git a/libiberty/aclocal.m4 b/libiberty/aclocal.m4
> index bf8a907100f..381ed3b27e3 100644
> --- a/libiberty/aclocal.m4
> +++ b/libiberty/aclocal.m4
> @@ -147,7 +147,7 @@ if test $ac_cv_os_cray = yes; then
> fi
>
> AC_CACHE_CHECK(stack direction for C alloca, ac_cv_c_stack_direction,
> -[AC_TRY_RUN([find_stack_direction ()
> +[AC_TRY_RUN([__attribute__ ((noclone,noinline)) find_stack_direction ()
> {
> static char *addr = 0;
> auto char dummy;
> diff --git a/libiberty/configure b/libiberty/configure
> index 7a34dabec32..e8391889cd7 100755
> --- a/libiberty/configure
> +++ b/libiberty/configure
> @@ -6532,7 +6532,7 @@ else
> else
> cat confdefs.h - <<_ACEOF >conftest.$ac_ext
> /* end confdefs.h. */
> -find_stack_direction ()
> +__attribute__ ((noclone,noinline)) find_stack_direction ()
> {
> static char *addr = 0;
> auto char dummy;
Jakub