It seems that on ia64, the function pthread_create does not use the value of
pthread_attr_setstacksize for the stack size, but something like the half of
it. The reproducer attached tries to fill the stack according to its supposed
size, and show that we are actually able to fill only half of it before getting
a segv.

gcc -g bug.c -o bug

gdb bug
(gdb) run 2000000 1900000

you should get something like:

7            arr [i] = 0xdeadbeef;
(gdb) print i * sizeof (int)
$2 = 904028  

So, although the given size of the stack is supposed to be something around
2Megs, there is less than 1Meg of stack where we can actually write.


-- 
           Summary: pthread_attr_setstacksize does not set the proper size
           Product: gcc
           Version: 3.4.6
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: ochem at gnat dot com
  GCC host triplet: ia64-sgi-linux-gnu, ia64-hp-hpux11.23, ia64-hp-linux-gnu
GCC target triplet: ia64-sgi-linux-gnu, ia64-hp-hpux11.23, ia64-hp-linux-gnu


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25533

Reply via email to