Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Problem compiling TBGEN from crafty ftp

Author: Vincent Vega

Date: 18:58:17 01/27/01

Go up one level in this thread


On January 27, 2001 at 00:40:41, Vincent Vega wrote:

>On January 26, 2001 at 17:26:21, Eugene Nalimov wrote:
>
>>On January 26, 2001 at 16:31:38, Lenard Spencer wrote:
>>
>>>Maybe someone can help me.  I have been trying to compile TBGEN on my Linux
>>>system (P1MMX/200 running Mandrake 7.0).  I use the command line given in the
>>>readme.txt but get a couple warnings and then it exits out without producing any
>>>executable.  Anything special I need to know here?  (No problems on my Win32
>>>box.)
>>>
>>>Thanks.
>>
>>Use reasonable C++ compiler, not junk like gcc.
>>
>>Eugene
>
>LOL, this is going a bit too far.  Gcc is far from perfect and I do use VC++
>most often but I can also show you quite a few examples of valid C++ code that
>Visual C++ 6 SP4 will choke on.  Code that was standard before its original
>release too.  On the other hand, VC++ does compile this beauty (from a recent
>microsoft.public.vc.language post):
>
>int main()
>{
>    return (*****main)->~ilikejelly(0.1f, "troz", main.~oh("eh?"));
>}
>
>And I don't remember gcc giving me "Internal compiler error" every week or so...

Hmmm, I must have pissed off some vengeful C++ gods by writing this because just
today I ran into a brand new Visual C++ 6.0 SP4 compiler bug ;-)  Here it is:

// bugdemo.cpp

#include "bug.h"

int main(int argc, char* argv[])
{
	Cbug bug;
	return 0;
}


// bug.h

class Cbug
{
public:
	Cbug();
	virtual ~Cbug() {}

	int x;

};



// bug.cpp

#include <stdio.h>
#include "bug.h"


Cbug::Cbug()
{
	x = 0;
	int k = 0;
	int u = 0;
	for (int m=1; m<2; m++)
	{
		x = 2*m;
		if (m == 1)
		{
			for (int d=1; d<2; d++)
			{
				if (2*d == x)
				{
					u = 1;
					break;
				}
			}
			if (u)
				k = 1;

			break;
		}
	}

	printf("k = %i\n", k);
}


Non-optimized Debug version correctly prints out k = 1, but optimized release
version (both minimize size and maximize speed) incorrectly prints out k = 0.



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.