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]

ARM problems with the exception unwinder



[ Andy, unfortunately your patch doesn't have any effect on this problem 
(though it doesn't make things any worse)]

I've run into a problem with the exception unwinder on the ARM.  In a 
nutshell, I can make it work for code with a stack frame, or I can make it 
work for code without; but I can't make it work for both at the same time.

The problem is that when the stack-pointer is stored in the frame of the 
callee of the function catching the throw, the unwind code updates the 
value there and I must not adjust the stack-pointer by OFFSET when 
returning from __throw/__rethrow.  However, if that function has not 
stored the stack-pointer in its frame, then I must adjust the 
stack-pointer by OFFSET.  The problem is, that I have no way of telling 
which method to use when compiling __builtin_eh_return since there is 
insufficient information available to make a dynamic choice.

The following test-case demonstrates the problem on arm-linux at any 
optization level above 0 (you can get the same behaviour on arm-elf or 
arm-aout if you add the flag -mno-apcs-frame).



extern "C" {
void abort(void);
void exit(int);
}

int throwval;

void foo(void)
{
  throw throwval;
}

void bar(void)
{
  try {
    foo();
  }
  catch(int) {
    throw;
  }
  catch(...) {
    abort();
  }
}

int main(void)
{
  try {
    bar();
  }
  catch(int) {
    exit(0);
  }
  abort();
}

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