This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c/44554] Stack space after sigsetjmp is reused



------- Comment #1 from christian dot eggers at kathrein dot de  2010-06-16 07:17 -------
Created an attachment (id=20925)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=20925&action=view)
Preprocessed source

compile with arm-linux-gnueabi-gcc -mcpu=arm920t -Os -o test.o -c test.i

This file is a stripped down version of the original source. Here __sigsetjmp
is used twice because pthread_cleanup_push()/pthread_cleanup_pop() are used
nested:

a = malloc();
pthread_cleanup_push(handler, a);
x = malloc() 
pthread_cleanup_push(handler, x)
...
pthread_cleanup_pop(1);
pthread_cleanup_pop(1);

The code is arranged in a way the the problem happens for both instances of
__cancel_arg are affected.

The bug is little bit "volatile", if you change the source it will usually
disappear or move to another position. For instance you may try removing the
marked line:

  comp_1 = 0.0;
  comp_2 = 0.0;
  for (i = 0; i < num_1 - delay1; ++i)
  {
-->   comp_1 += conj(comp_out[i]) * comp_out[i];
      comp_2 += conj(comp_out[i]) * comp_in[i];
  }

siglongjmp() is only used for demonstration purposes. You can also link with
"-pthreads -lm" to a full executable demo.


-- 


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]