Re: Can never debug Release Build Configuration
Re: Can never debug Release Build Configuration
- Subject: Re: Can never debug Release Build Configuration
- From: Jack Repenning <email@hidden>
- Date: Thu, 19 Apr 2007 15:05:34 -0700
On Apr 19, 2007, at 2:39 PM, Michael Watson wrote:
On 19 Apr, 2007, at 15:30, Jonas Maebe wrote:
Turn on debugging information for your release build, and hope
that the optimizations do not mess up your debugging too much. I
don't really see the point, though (unless you have a bug which
only occurs in a release build).
And if there is a bug that only occurs in release, that warrants
additional investigation of your code/project.
Well, once (in 25 years) I have seen a bug that really "turned on and
off" depending on whether the code was optimized (not counting timing
bugs, which can have that behavior but are also likely to happen the
other way, just less often). As it happens, this bug only caused
problems in the debug code: the optimizer actually fixed the bug!
So it does happen.
Not very often.
The problem: there was a stack variable that was uninitialized along
some code paths, and trivially initialized along some others; the
optimizer correctly inferred that there was no *harm* in pulling that
initialization up out of a loop construct where it had been coded,
and actually doing it during the preamble of the procedure, so that's
what it did! So the code was something like:
int brokencode(int inputval)
{
int returnval;
if (dosomefancytest()) {
while (1) {
returnval = inputval;
if (dosomeptherfancytest()) {
returnval = someotherval;
break;
}
}
}
else {
return returnval;
}
}
... and the optimizer transformed the declaration to "int returnval =
inputval;" which actually was the desired behavior when
dosomefancytest() failed.
-==-
Jack Repenning
Chief Technology Officer
CollabNet, Inc.
8000 Marina Boulevard, Suite 600
Brisbane, California 94005
office: +1 650.228.2562
mobile: +1 408.835.8090
raindance: +1 877.326.2337, x844.7461
aim: jackrepenning
skype: jrepenning
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden