discuss-gnustep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Possible MacOS X compier problem


From: Bill Northcott
Subject: Possible MacOS X compier problem
Date: Mon, 21 Jul 2003 10:27:45 +1000

My apologies for cross posting.  As we use the GNU runtime, I thought 
someone on GNUstep might have seen something similar.

We seem to be having problems with nested method calls.  This is faintly 
reminiscent of an old Apple compiler problem (2912451) but more subtle. We 
are trying to produce a simple test case.  If anyone has any suggestions, 
we would be very interested.  This code is used with the GNU runtime.  If 
we can produce a simple test case we will try the Apple one as well.

The following code works with the FSF compiler but not with the recent 
(gcc-1465) Apple version.
        return [[[ArchiverQuoted createBegin: aZone]
                 setQuotedObject: [self getExpr]]
                  createEnd];
When built with the Apple compiler the code never returns from 
setQuotedObject and CreateEnd is never called.  Execution sort of drops 
through.  It may be important that this code is in the getExpr method 
which is being called recursively to parse a Lisp data file.

Rewriting the line thus solves the problem:
               id newArch = [[ArchiverQuoted createBegin: aZone] 
setQuotedObject: [self getExpr]];
         return [newArch createEnd];

The similar line below executed in the same context works correctly with 
either compiler:
          value = [[[ArchiverValue createBegin: aZone]
                     setClass: objc_lookup_class ([newObj getC])]
                    createEnd];

In a different context here are a few lines that fail with the Apple 
compiler but work with the FSF version. As far as we can see they all fail 
to execute all the method calls.
Originally the line (which fails on Apple compiler) was:
  return [[[self createBegin: [p getZone]] setParent: p] createEnd];

and this does not work:
  id newObj = [self createBegin:  [p getZone]];
  return [[newObj setParent: p] createEnd];

neither does this:
  id newObj = [[[self createBegin: [p getZone]] setParent: p] createEnd];
  return newObj;

also broken:
  id newZone = [p getZone];
  id newObj = [self createBegin: newZone];
  return [[newObj setParent: p] createEnd];

this breaks too:
  id newZone = [p getZone];
  return [[[self createBegin: newZone] setParent: p] createEnd];

and this one is no good:
  id newZone = [p getZone];
  id newObj = [[[self createBegin: newZone] setParent: p] createEnd];
  return newObj;


But this version works:
  id newZone = [p getZone];
  id newObj = [[self createBegin: newZone] setParent: p];
  return [newObj createEnd];

So does this:
  id newObj = [self createBegin:  [p getZone]];
 [newObj setParent: p];
  return [newObj createEnd];

As does this:
    id newZone = [p getZone];
    id newObj = [[self createBegin:  newZone] setParent: p];
    return [newObj createEnd];

Even this works:
    id newObj = [[self createBegin:  [p getZone]] setParent: p];
    return [newObj createEnd];

Any thoughts gratefully received.
Bill Northcott
Swarm Development Group
http://www.swarm.org




reply via email to

[Prev in Thread] Current Thread [Next in Thread]