Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: MSVC Bugs.

Author: Scott Gasch

Date: 14:19:21 11/27/01

Go up one level in this thread


On November 27, 2001 at 16:12:24, Miguel A. Ballicora wrote:

>Has anybody experienced bugs from MS Visual C 6.0 when programming in C?

Yes, once.

>A couple of times I have observed weird behaviors that after a lot of debugging
>I had to conclude that there was something weird with the compiler or optimizer.
>For instance, I include a printf() to debug part of the program and that was
>never printed. It just skipped that instruction. I had no idea what it was
>because I just rewrote the function to make it work.

Did you try dumping the assembly generated for your function in a debugger and
sanity checking it?  The presence of absence of a "call _printf" should be easy
to verify.  Such blatant code generation bugs are rare, I think.

>Most of the time I think
>that I am wrong (most of the time I am wrong) but there are some things that do
>not make sense. Now I am facing a problem that probably is me, but it look very
>suspicious. I'll comment on that when I am sure I spent enough time on it.
[snip]

Would be curious to hear about it.

I've found that most of the time it's a bug in my code... I have a bad habit of
blaming the compiler and then digging in and finding its my own bug.

That said, once I found a glaring code gen bug in MSVC once and was forced to
work around it.  It took me a full day of tedious debugging but the problem was
in my pawn evaluation function where MSVC had generated code that used the wrong
register.  I was or-ing a flag into the a member of one struct and the compiler
generated code using a register containing a pointer to an entirely different
struct.  This caused garbage in my position (board) that later caused a crash in
the SEE.  The problem only repeated with full optimization turned on.  I ran
into this when I first ported from gcc to MSVC6.0 (SP4, I think).

I then took my code in to work with me where we use development versions of
MSVC7.0 and the problem seems to be fixed in the newer (forthcoming) compilers.

Scott



This page took 0 seconds to execute

Last modified: Thu, 15 Apr 21 08:11:13 -0700

Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.