This is the mail archive of the gcc@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]

Re: ia64 unwind thoughts


On Fri, Feb 23, 2001 at 11:56:49PM +0000, Jason Merrill wrote:
> > Oh, that's right, no-throw is supposed to be terminate(), isn't it.
> 
> Yes.

Irritating that it's nearly, but not quite, the same -- unexpected 
will eventually have to call terminate, since a specification of
throw() doesn't allow anything to propagate.  But that damned user
unexpected_handler gets called first.  :-/

So I guess something like 

	struct A { ~A(); };
	int x;
	A::~A()
	{
	  try {
	    f1();
	  } catch (int) {
	    x++;
	  }
	}
	void f0()
	{
	  A a1;
	  f2();
	}

would before inlining be

	f0:
	  f2();			// L1, no action
	  a1.~A();		// ???
	  return;
	L1:
	  a1.~A();		// No call-site entry
	  _Unwind_Resume;

and after inlining be

	f0:
	  f2();			// L1, no action
	  f1();			// L2
	R2:
	  return;
	L1:
	  f1();			// L3
	R3:
	  _Unwind_Resume;
	L2:
	  switch (selector)
	  {
	  case 1:		// int
	    x++;
	    goto R2;
	  }
	  // ???
	L3:
	  switch (selector)
	  {
	  case 1:		// int
	    x++;
	    goto R3;
	  }
	  terminate();

I don't actually know what's supposed to happen if a destructor not
inside a cleanup throws.  I suspect it is simply considered outside
that region, and the answer is "nothing happens".

> > 	(0) Can't throw.
> No call site record.
> 
> > 	(1) Can throw, no cleanup or handler this function.
> Call site record, no landing pad.
> 
> > 	(2) Can throw, only cleanup this function.
> Landing pad, no action record.
> 
> > 	(3) Can throw, (...) handler.
> Action record, type index of 0.

Right.  I'll go with this.


r~


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