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

Bug#575351: -fexceptions and unwind



Package: gcc-4.4-hppa-linux-gnu
Severity: normal

I think that I found (when debugging Boehm GC) a gcc bug on hppa.

Attached is a testcase program, test-pthread-cancel.c.

I test it on paer.debian.org, where the kernel is:
Linux version 2.6.32-3-parisc64 (Debian 2.6.32-9) (maks@debian.org) (gcc version 4.3.4 (GCC) ) #1 Thu Feb 25 13:08:44 UTC 2010

$ gcc -pthread test-pthread-cancel.c
$ ./a.out
clean it up
$ gcc -pthread test-pthread-cancel.c -fexceptions
$ ./a.out
$
# No output

On i486-pc-linux-gnu, we see output for both cases (with/without
-fexceptions).

It seems that signal handling has been changed after
gcc-4.4.3/gcc/config/pa/linux-unwind.h was written.

We can see the value 0x34190000 at the register rp, but not at
the register sp.

----------------------------------- test-pthread-cancel.c
#include <pthread.h>
#include <time.h>
#include <stdio.h>

static void
clean(void *arg)
{
  puts ("clean it up");
}

static void *
f(void *arg)
{
  struct timespec t;
  t.tv_sec = 0;
  t.tv_nsec = 1000;

  pthread_cleanup_push (clean, NULL);

  while (1)
    nanosleep (&t, NULL);

  pthread_cleanup_pop(1);
}

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

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

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


Reply to: