Re: AAAAAHHHH!! Locals getting trampled (windbg prob- lem?)

I know what the VC++ docs say, but the absence of a /Oi and the presence of
a #pragma intrinsic results in an unstable driver, so the docs are not
entirely correct. Not the first bug in the docs, is it?

Phil

-----Original Message-----
From: Jay Talbott [mailto:xxxxx@mcg.mot.com]
Sent: Friday, March 02, 2001 10:29 AM
To: NT Developers Interest List
Subject: [ntdev] Re: AAAAAHHHH!! Locals getting trampled (windbg
problem?)

A free build, with full optimization, implies /Oi by default. If you
do a free build and look in buildfre.log for what optimization flags
are specified by default, you find /Oxs /Oy. The VC++ docs for the
/Ox states that is equivalent to /Ob1 /Og /Oi /Ot /Oy /Gs. So a free
build already always has /Oi, and thus does not need to be added to
the DDK setenv.bat file. The /Os specifies favoring size over speed,
counteracting the /Ot implied by /Ox.

The problem with the checked build was that the lack of any
optimization flags in the setenv.bat file results in full
optimization, just like a free build. The fix provided in the
knowledge base article I mentioned before resolves the problem.
With a fixed checked build environment, the compiler optimization
flags are /Od /Oi /Oy-.

The /Oy- added in a checked build, and /Oy added in a free build
always override any user specified optimizations to make sure that
frame pointers are always created on the call stack for checked
builds for debugging purposes, and are NOT created on free builds
for faster performance. These seem to always be tacked on the end
of the default and/or specified optimization flags.

  • Jay


Jay Talbott
Staff Software Engineer
Motorola Computer Group
2900 S. Diablo Way
DW220
Tempe, AZ 85282
(602) 438-3481
xxxxx@mcg.mot.com

“Barila, Phil” wrote:

/Oi is an optimization. If you specify /Od without it, you will get
absolutely no optimization. Not sure why MS defined /Oi in the Checked
build, but not the Free build, unless they were intending that the default
optimization in the Free build favor code size over speed. If I am
reading
the MSDN library entry correctly, you only get intrinsics that you define
in
the #pragma, so if you /Oi, but don’t define the intrinsic, you don’t get
the inlined instructions. So the effect is the same as /Od only. Anyone
know if I read the doc right?

Yes, *if* you use intrinsics, you must have /Oi, or you will build faulty
images. I discovered this by accident, when I took over development of
something that someone else had started, which used several intrinsics.
If
you define the intrinsic, but don’t specify /Oi, you get confusing
crashes.
You won’t get linker errors, you won’t get compile errors, just the
crashes.

And yes, I think the default should be to have /Oi set in both build
environments, but I was bit quite painfully by its absence. Since it
appears that those of us who use defined intrinsics are a small minority
of
DDK users, it’s probably a no-op for most people. Absolutely necessary
for
those of us who need it, though.

Phil

-----Original Message-----
From: Nate Bushman [mailto:xxxxx@Legato.com]
Sent: Thursday, March 01, 2001 4:17 PM
To: NT Developers Interest List
Subject: [ntdev] Re: AAAAAHHHH!! Locals getting trampled (windbg prob
lem?)

I’m a bit confused. First, the KB article that Jay Talbott
mentions says that (if I understand this correctly) you can
turn off the default optimization in a checked build by
modifying %BASEDIR%\bin\Setenv.bat so that it does this…
set MSC_OPTIMIZATION=/Od /Oi

Why wouldn’t “set MSC_OPTIMIZATION=/Od” be sufficient? The
MSDN docs say that /Od will disable ALL optimizations. Wouldn’t
this include the /Oi optimization?

>From the rest of the posts, am I right in stating that W2K free
builds will generate faulty images if you use intrinsic functions
in your code? Is the solution to this to add the following
line to your SOURCES file:
MSC_OPTIMIZATION=/Oi
Or should you edit setenv.bat to set this environment variable?

If this bug is for real, it seems that everyone should be using
/Oi for their free builds to ensure that they don’t end up building
faulty images.


You are currently subscribed to ntdev as: xxxxx@mcg.mot.com
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com


You are currently subscribed to ntdev as: xxxxx@intel.com
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com


You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com