Current-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Stack alignement with pthreads



Hi all,

To make a long story short, I've got a problem with stack alignment in threads
created by pthread_create() and compiled with gcc, running a recent -curent.

It *seems* that the stack of pthreads is always offset by 4 bytes, thus messing
up the gcc aligment efforts. Below is a short program that illustrates this.

Any hint?

# cat test.c
#include <stdio.h>
#include <pthread.h>

void *
test(void *data)
{
  int test __attribute__((aligned(16)));
  printf("%p\n", &test);
}

int
main()
{
  pthread_t tg;

  pthread_create(&tg, NULL, test, NULL);
  pthread_join(tg, NULL);
  return 0;
}
# gcc -o test test.c -pthread
# ./test
0xbb7ffda4

-- 
Anthony


Home | Main Index | Thread Index | Old Index