I compile the following code
with gcc (version 4.2.1 20070719 [FreeBSD]) and the -O3 flag set on a
FreeBSD System (8.1-RELEASE FreeBSD 8.1-RELEASE #0).
When I run it I always get a trace trap:
Any suggestion what the problem might be? Btw. if I remove the always_inline
attribute and hence the stosb function isn't inlined anymore everything works
fine.
Thanks in advance
Code:
#include <stdint.h>
static __attribute__((always_inline))
void
stosb ( char *dst, unsigned long len, char val)
{
__asm__ volatile (
"pushfq; "
"cld; "
"rep stosb; "
"popfq;"
: "=c" (len), "=D" (dst)
: "c" (len), "a" (val), "D" (dst)
: "memory" );
};
int
main ()
{
uint64_t value_64;
stosb ((void*) &value_64, sizeof(value_64), 1 );
}
with gcc (version 4.2.1 20070719 [FreeBSD]) and the -O3 flag set on a
FreeBSD System (8.1-RELEASE FreeBSD 8.1-RELEASE #0).
When I run it I always get a trace trap:
Code:
% ./build/bin/test_memory
zsh: trace trap (core dumped) ./build/bin/test_memory
Any suggestion what the problem might be? Btw. if I remove the always_inline
attribute and hence the stosb function isn't inlined anymore everything works
fine.
Thanks in advance