[PC] VC++ Compiler Bugs
ctownsend at arboretum.com
Thu Sep 3 12:50:59 EDT 1998
I had a bug that sounds similar to yours that drove me nuts for over a
month, while I tried to figure out what was wrong. When I compiled in
release mode and using certain buffer sizes sometimes I would get garbled
output, yet otherwise it worked fine. The I found the problem was due to
improper truncation when converting from floats to ints. This integer
result was used to calculate the number of FFT butterflies, and of course
with the wrong number of butterflies being computed I got out total crap.
So some of the time the compiler used creative optimizations which would
cause for example log(1024)/log(2.0) to equal 9.999999999999999999 instead
of 10.0, and since C++ uses truncation instead of rounding 9.999999 then
equals 9.0 instead of 10.0. An easy way to fix this problem in some cases
is just to add 0.5 before you truncate. Your problem certainly may be
different, but I suspect it is probably along the same line.
At 02:14 PM 9/2/98 -0700, you wrote:
>I was just wondering if I am the only one driven nuts by compiler bugs in
>the MS VC++. I wonder if it is a problem with my code or with the
>compiler -- I go crazy trying to figure things out.
>Most recently, I have a function that works perfectly when compiled in debug
>mode -- but in release mode, it has strange precision errors that cause
>distortion in the audio files it creates. I went in and turned off all
>compiler optimizations to no avail. There is just some difference between
>the debug and release DLL's that is causing me a headache.
>Has anyone else had strange floating point problems / errors like this? Is
>it something explicit casts all over the place can fix? Is it possibly a
>logic error that the debug DLL's are masking? I am stuck as to where to
>I used to have a problem running my software on NT until I upgraded my
>compiler to the latest version (6 months ago). Is there maybe a new upgrade
>that I should download (at 80+MB)?
>b r e n d o n
>bcassidy at shoko.calarts.edu
Chris Townsend - DSP Engineer
Arboretum Systems, Inc.
More information about the music-dsp