Bad assembly code generation?
Bad assembly code generation?
- Subject: Bad assembly code generation?
- From: joie(mecha : himitsu) <email@hidden>
- Date: Thu, 29 Aug 2002 23:26:33 -0500
here's a copy of a bug report i just filed... has anyone else seen this
sort of behavior?
problem id number 3037572
* SUMMARY
An objective-c 'setter' method fails to set to a proper value when it
takes an argument of the form: [object accessorMethod] op x, where x is
any number and op is addition or subtraction.
* STEPS TO REPRODUCE
1. Create a Foundation Tool in Project Builder(currently using the
August 28th developer tools; I think this is the root of the problem).
Create a class, "TestObject", with one integer instance variable,
"number", and a 'getter' and 'setter' method for 'number'. The
'getter' should merely 'return number;' and the setter should set
number to the new value and 'return self;' (as per smalltalk
conventions...)
2. In main.m...
int number;
TestObject * instance = [TestObject new];
[instance setNumber:0];
[instance setNumber:[instance number]+1];
NSLog(@"the number is:%d.", [instance number]);
[instance setNumber:0];
number = [instance number];
number++;
[instance setNumber:number];
NSLog(@"the number is:%d.", [instance number]);
* RESULTS
The first will print '4' or something equally ridiculous. all this
would be simple if not for the fact that the second works just fine,
setting number to 1 as expected.
* REGRESSION
The problem didn't seem to occur under earlier revisions of the dev
tools than the august 2002 tools. The problem also vanishes when
object_getInstanceVariable() is used, or when something of the form:
[object setNumber:[object number]*1+1]; is used. In all, it's very
strange.
* NOTES
It seems like a bad assembly code generation problem.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.