Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Solaris 8-10: data types: stronger as Linux and Windows ?

Author: Gerd Isenberg

Date: 12:03:22 10/25/05

Go up one level in this thread


On October 25, 2005 at 13:36:34, Eugene Nalimov wrote:

>On October 25, 2005 at 09:53:51, Gerd Isenberg wrote:
>
>>On October 25, 2005 at 08:39:07, Daniel Mehrmannn wrote:
>>
>>>Hi,
>>>
>>>well i found a bug in my engine. I declare the boolean variable "stop_search" in
>>>search.c. I made the error that i call this variable as "extern int stop_search"
>>>from other files.
>>>
>>>Interesting:
>>>- No compiler found this error (gcc, icc, vc 6.0  (also solaris))
>>>- On Windows and Linux(!) the engine runs without any problems.
>>>
>>>Expect Solaris 8-10 (Sparc) family created a "segmentation fault" at first
>>>access.
>>>
>>>How is this possible ? Why other plattforms and compiler ignored this problem ?
>>>I only do a read access of this extern variable.
>>>
>>>see here: http://www.homer-chess.com/images/sol9.jpg
>>>
>>>Best,
>>>Daniel
>>
>>Hi Daniel,
>>
>>it depends where the linker "allocates" the boolean variable with sizeof one
>>byte. If it is "near" a 4K-Page boundary (1000h), let say at 0xffe or 0xfff, a
>>byte read/write is fine, while an "external" dword read will crash.
>>
>>Did you do the external declaration inside a shared header file (i guess no)?
>>Imagine the extern declaration is included from a shared h file,
>>
>>extern int foo;
>>bool foo;
>>
>>then the compiler recognizes the error:
>>error C2371: 'foo' : redefinition; different basic types
>>
>>while this is fine:
>>
>>extern bool foo;
>>bool foo;
>>
>>Otherwise with disjoint declaration in C-files the compiler has no chance to
>>detect the error, while the linker is probably overstrained with type checking
>>of symbols (probably one reason that C++ names put some type information to
>>symbols).
>>
>>Gerd
>
>In Visual C 8.0 we will recognize such case and give you warning if the program
>is compiled with link-time code generation (/GL compiler flag).
>
>Thanks,
>Eugene

What other benefit has link-time code generation?

Thanks,
Gerd



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.