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

Bug#575351: This is not the bug of GCC but glibc



No, this is not the bug of GCC.  Alhough config/pa/linux-unwind.h
looks incorrect at first glance (TRAMP_SIZE is 9), it runs correctly
(because of padding).

In fact, following program runc correctly on hppa too, we see
"clean it up".

$ gcc -fexceptions -save-temps func.c test-pthread-cancel-3.c -pthread
$ ./a.out

I think that the bug is in GNU C library port of hppa.

------------------ func.c
void func (void)
{
  for (;;);
}
------------------ test-pthread-cancel-3.c
#include <pthread.h>
#include <time.h>

static void
clean(void *arg)
{
  write (1, "clean it up\n", 12);
}

extern void func(void);

static void *
f(void *arg)
{
  pthread_cleanup_push (clean, NULL);
  pthread_setcanceltype (PTHREAD_CANCEL_ASYNCHRONOUS, NULL);
  for (;;)
    func ();
  pthread_setcanceltype (PTHREAD_CANCEL_DEFERRED, NULL);

  pthread_cleanup_pop(1);
}

int
main (int argc, char argv[])
{
  struct timespec t;
  t.tv_sec = 1;
  t.tv_nsec = 0;

  pthread_t tid;
  pthread_create (&tid, NULL, f, NULL);

  nanosleep (&t, NULL);
  pthread_cancel (tid);
  pthread_join (tid, NULL);
}
------------------
-- 



Reply to: