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

Re: ppc: fix for pr31281, ObjC try-catch ICEs 4.2



On Mar 28, 2007, at 11:22 AM, Andrew Pinski wrote:


On 3/28/07, Stuart Hastings <stuart@apple.com> wrote:
Do you want the testcase? It's pretty nonsensical:

int f(unsigned int i)
{
  @try { } @catch(id) { }
  for (;;)
    for (;;)
      @try {
        if (i)
          break;
      } @catch(id) { }
}

If you want the testcase, I'm guessing it would become .../testsuite/
objc.dg/pr31281.m (?).

Can you turn this into a quick execute testcase and put it into objc/execute/exceptions so that it gets run by both the next and gnu runtimes. It might be better if objc/compile/exceptions is added for such compile time testcase also.

After some hacking (IANAOCE, I Am Not An Objective-C Expert :-), I got this:


/* From PR31281.  */
extern void abort (void);
int __attribute__((noinline))
f(unsigned int i)
{
  int j, k;
  @try { } @catch(id) { return 13; }
  for (j=0; j<i; j++)
    for (k=0; k<i; k++)
      {
        @try {
          if (i)
            break;
        } @catch(id) { }
        return 9;
      }
  return 0;
}

int
main()
{
  if (f(1))
    abort ();
  return 0 ;
}

This seems to ICE the current 4.2 compiler, compile with Ian's refinement of my patch, AND execute without error on my PPC OS X box (NeXT runtime).

However, it's kinda weak as an executable testcase; it's pretty implausible that either of the non-zero returns will get executed, and almost any change alters the CFG enough for it to compile with the current 4.2. (Any suggestions to make it more plausible or robust are welcome.)

Assuming it's acceptable, where would you like it? objc/execute/ exceptions/pr31281.m ?

Thanks,

You're very welcome,


stuart hastings
Apple


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