I have a service, which compiles and works ok in a
debug build, but in the release build it doesn’t. The
place where it fails is a call to RegQueryValueEx.
While debugging I inserted a breakpoint in the
function(a la _asm int 3) and traced, the code worked
in the release build as well, but without the
breakpoint it doesn’t.
The code doesn’t work if I put the breakpoint outside
the function.
I inserted a “nop” in the same function and the code
works. Is it a problem with the VC optimisation??
ac
Do you Yahoo!?
Yahoo! Tax Center - File online, calculators, forms, and more http://tax.yahoo.com
“Akash Chouhan” wrote in message news:xxxxx@ntdev… > > I have a service, which compiles and works ok in a > debug build, but in the release build it doesn’t. The > place where it fails is a call to RegQueryValueEx. > While debugging I inserted a breakpoint in the > function(a la _asm int 3) and traced, the code worked > in the release build as well, but without the > breakpoint it doesn’t. > The code doesn’t work if I put the breakpoint outside > the function. > I inserted a “nop” in the same function and the code > works. Is it a problem with the VC optimisation?? > ac > > __________________________________________________ > Do you Yahoo!? > Yahoo! Tax Center - File online, calculators, forms, and more > http://tax.yahoo.com > > >
You can use #pragma optimize(“”, off) and see if that fixes it. However,
in my experience, code which works in debug mode and fails in release mode
more often has a bug in it than a bug in the optimizer.
> You can use #pragma optimize(“”, off) and see if that fixes it.
However,
in my experience, code which works in debug mode and fails in
release mode
more often has a bug in it than a bug in the optimizer.
Try to tweak the checked build, enabling the DBG macro and
optimizations separately.
If the bug is due to DBG macro - then this is a coder’s bug,
otherwise, the optimizer is to blame - though I saw this in 1997 with
early MSVC5 only.
I’d agree with previous replies; probability of optimizer bug is much lower
that a bug in your code. Though I’ve seen some optimizer problems in the
past.
It can be timing problem. Release code is faster than debug one and
breakpoint or nop can make a difference between success and failure. If you
suspect optimizer problem, disassemble function without and with nop and
examine differences.
Best regards,
Michal Vodicka
STMicroelectronics Design and Application s.r.o.
[michal.vodicka@st.com, http:://www.st.com]
I have a service, which compiles and works ok in a
debug build, but in the release build it doesn’t. The
place where it fails is a call to RegQueryValueEx.
While debugging I inserted a breakpoint in the
function(a la _asm int 3) and traced, the code worked
in the release build as well, but without the
breakpoint it doesn’t.
The code doesn’t work if I put the breakpoint outside
the function.
I inserted a “nop” in the same function and the code
works. Is it a problem with the VC optimisation??
ac
Do you Yahoo!?
Yahoo! Tax Center - File online, calculators, forms, and more http://tax.yahoo.com