[LTP] LTP release

Cyril Hrubis
2020-09-09T13:27:03Z

Hi!
> Also I would like to get rid of the -fno-optimize-sibling-calls in the
> Makefile, this makes the test a bit fragile and less portable.

What about this code:

#include <stdint.h>
#include <stdio.h>

static intptr_t addr_func(void) __attribute__((noinline));

static intptr_t addr_func(void)
{
int a;

return (intptr_t)&a;
}

/*
* Returns negative number if stack grows down, possitive if stack grows up
*/
static int stack_dir(void)
{
intptr_t addr = addr_func();

printf("%p %p\n", &addr, (void*)addr);

return addr - (intptr_t)&addr;
}

int main(void)
{
printf("%i\n", stack_dir());

return 0;
}

--
Cyril Hrubis
chrubis@suse.cz