FROM : Shawn Erickson
DATE : Sat Jun 03 19:14:01 2006
On Jun 3, 2006, at 8:03 AM, Buddy Kurz wrote:
> FWIW: I experienced a similar problem when an application randomly
> crashed at the same spot on Intel but worked OK on PPC.
> I was tracking a changing string value using something like if (!
> ([oldValue isEqualTo:newValue]) {...}
> The crash occurred on Intel when the oldValue had not been set.
> The problem was either -NSString isEqualTo:(NSString)arg crashing
> on a nil object value (on intel) or a non-nil un-initialized
> object pointer in the method. I was unable to duplicate the problem
> in a simpler test application.
>
> My solution was to initialize the oldValue to @"" (I was assuming a
> nil value was the culprit)
> In retrospect, I'm wondering if there was just some random value in
> the un-initialized variable.
That sounds like you had a bug in your code exposed when running on
Intel.
If you attempt to send a message to an unintialized variable (stack
based) you have the chance of attempting to send a message using an
invalid pointer. The way the stack is managed on PowerPC and Intel is
different so when running on Intel you likely had a better chance of
hitting the issue.
Sending a message to nil will not cause a crash on either platform
(unless you some how hit a bug in the objective-c runtime but I kinda
doubt that).
-Shawn
DATE : Sat Jun 03 19:14:01 2006
On Jun 3, 2006, at 8:03 AM, Buddy Kurz wrote:
> FWIW: I experienced a similar problem when an application randomly
> crashed at the same spot on Intel but worked OK on PPC.
> I was tracking a changing string value using something like if (!
> ([oldValue isEqualTo:newValue]) {...}
> The crash occurred on Intel when the oldValue had not been set.
> The problem was either -NSString isEqualTo:(NSString)arg crashing
> on a nil object value (on intel) or a non-nil un-initialized
> object pointer in the method. I was unable to duplicate the problem
> in a simpler test application.
>
> My solution was to initialize the oldValue to @"" (I was assuming a
> nil value was the culprit)
> In retrospect, I'm wondering if there was just some random value in
> the un-initialized variable.
That sounds like you had a bug in your code exposed when running on
Intel.
If you attempt to send a message to an unintialized variable (stack
based) you have the chance of attempting to send a message using an
invalid pointer. The way the stack is managed on PowerPC and Intel is
different so when running on Intel you likely had a better chance of
hitting the issue.
Sending a message to nil will not cause a crash on either platform
(unless you some how hit a bug in the objective-c runtime but I kinda
doubt that).
-Shawn
| Related mails | Author | Date |
|---|---|---|
| Karim Morsy | Jun 3, 12:38 | |
| Lon Giese | Jun 3, 14:31 | |
| Chris Suter | Jun 3, 15:39 | |
| Buddy Kurz | Jun 3, 17:03 | |
| Shawn Erickson | Jun 3, 19:14 |






Cocoa mail archive

