quick question about compiling Stockfish with icc

Discussion of chess software programming and technical issues.

Moderators: hgm, Rebel, chrisw

Justin Sherron
Posts: 29
Joined: Thu Mar 04, 2010 11:35 pm

quick question about compiling Stockfish with icc

Post by Justin Sherron »

After compiling Stockfish with the latest free Intel C++ compiler for Linux (using the standard "make profile-build ARCH=x86-64 COMP=icc"), I noticed amongst the wall of text produced in the terminal during compiling was this:

Code: Select all

pawns.cpp(347): remark #2259: non-pointer conversion from "unsigned int" to "uint8_t={unsigned char}" may lose significant bits
    kingShelters[c] = shelter;
                    ^

pawns.cpp(195): remark #2259: non-pointer conversion from "int" to "int16_t={short}" may lose significant bits
            pi->ksStormValue[Us] += KStormOpenFileBonus[f];
                                 ^

pawns.cpp(196): remark #2259: non-pointer conversion from "int" to "int16_t={short}" may lose significant bits
            pi->qsStormValue[Us] += QStormOpenFileBonus[f];
                                 ^

pawns.cpp(197): remark #2259: non-pointer conversion from "int" to "uint8_t={unsigned char}" may lose significant bits
            pi->halfOpenFiles&#91;Us&#93; |= &#40;1 << f&#41;;
                                  ^

pawns.cpp&#40;211&#41;&#58; remark #2259&#58; non-pointer conversion from "int" to "int16_t=&#123;short&#125;" may lose significant bits
        pi->ksStormValue&#91;Us&#93; += KStormTable&#91;relative_square&#40;Us, s&#41;&#93; + bonus;
                             ^

pawns.cpp&#40;214&#41;&#58; remark #2259&#58; non-pointer conversion from "int" to "int16_t=&#123;short&#125;" may lose significant bits
        pi->qsStormValue&#91;Us&#93; += QStormTable&#91;relative_square&#40;Us, s&#41;&#93; + bonus;
                             ^
and this:

Code: Select all

misc.cpp&#40;233&#41;&#58; remark #593&#58; variable "__d0" was set but never used
    FD_ZERO&#40;&readfds&#41;;
    ^

misc.cpp&#40;233&#41;&#58; remark #593&#58; variable "__d1" was set but never used
    FD_ZERO&#40;&readfds&#41;;
    ^
Does this indicate some sort of problem? I don't know how to interpret 99% of code I look at, but not using variables and "losing significant bits" sound bad, even if a functional program was created. Did I do something wrong during this process, or are the posted pieces of code completely inconsequential? Thanks for any input.

-Justin

Edit: In the first code box, the ^ characters actually appeared under the corresponding =, +=, or |= characters in my terminal. It appears copy and paste may have failed me here.
Dann Corbit
Posts: 12542
Joined: Wed Mar 08, 2006 8:57 pm
Location: Redmond, WA USA

Re: quick question about compiling Stockfish with icc

Post by Dann Corbit »

The "may lose bits" messages are only a problem if you try to store a large number into a smaller one. I guess that none of those messages has any value.

The "not used" messages are pure noise.
Justin Sherron
Posts: 29
Joined: Thu Mar 04, 2010 11:35 pm

Re: quick question about compiling Stockfish with icc

Post by Justin Sherron »

Thanks for the clarification. It was my first attempt at compiling with something other than gcc, which never produced similar messages during my experience.
bob
Posts: 20943
Joined: Mon Feb 27, 2006 7:30 pm
Location: Birmingham, AL

Re: quick question about compiling Stockfish with icc

Post by bob »

Justin Sherron wrote:After compiling Stockfish with the latest free Intel C++ compiler for Linux (using the standard "make profile-build ARCH=x86-64 COMP=icc"), I noticed amongst the wall of text produced in the terminal during compiling was this:

Code: Select all

pawns.cpp&#40;347&#41;&#58; remark #2259&#58; non-pointer conversion from "unsigned int" to "uint8_t=&#123;unsigned char&#125;" may lose significant bits
    kingShelters&#91;c&#93; = shelter;
                    ^

pawns.cpp&#40;195&#41;&#58; remark #2259&#58; non-pointer conversion from "int" to "int16_t=&#123;short&#125;" may lose significant bits
            pi->ksStormValue&#91;Us&#93; += KStormOpenFileBonus&#91;f&#93;;
                                 ^

pawns.cpp&#40;196&#41;&#58; remark #2259&#58; non-pointer conversion from "int" to "int16_t=&#123;short&#125;" may lose significant bits
            pi->qsStormValue&#91;Us&#93; += QStormOpenFileBonus&#91;f&#93;;
                                 ^

pawns.cpp&#40;197&#41;&#58; remark #2259&#58; non-pointer conversion from "int" to "uint8_t=&#123;unsigned char&#125;" may lose significant bits
            pi->halfOpenFiles&#91;Us&#93; |= &#40;1 << f&#41;;
                                  ^

pawns.cpp&#40;211&#41;&#58; remark #2259&#58; non-pointer conversion from "int" to "int16_t=&#123;short&#125;" may lose significant bits
        pi->ksStormValue&#91;Us&#93; += KStormTable&#91;relative_square&#40;Us, s&#41;&#93; + bonus;
                             ^

pawns.cpp&#40;214&#41;&#58; remark #2259&#58; non-pointer conversion from "int" to "int16_t=&#123;short&#125;" may lose significant bits
        pi->qsStormValue&#91;Us&#93; += QStormTable&#91;relative_square&#40;Us, s&#41;&#93; + bonus;
                             ^
and this:

Code: Select all

misc.cpp&#40;233&#41;&#58; remark #593&#58; variable "__d0" was set but never used
    FD_ZERO&#40;&readfds&#41;;
    ^

misc.cpp&#40;233&#41;&#58; remark #593&#58; variable "__d1" was set but never used
    FD_ZERO&#40;&readfds&#41;;
    ^
Does this indicate some sort of problem? I don't know how to interpret 99% of code I look at, but not using variables and "losing significant bits" sound bad, even if a functional program was created. Did I do something wrong during this process, or are the posted pieces of code completely inconsequential? Thanks for any input.

-Justin

Edit: In the first code box, the ^ characters actually appeared under the corresponding =, +=, or |= characters in my terminal. It appears copy and paste may have failed me here.
The last two are certainly irrelevant. FD_ZERO() is a macro used to zero a descriptor list that is going to be used in select() to do a check to see if input is available. I had mentioned the numerous warnings a good while back. The SF team thought they were all unimportant, so I wouldn't worry about them as long as the program seems to run correctly. I don't like warnings myself, because a bunch of superfluous warnings can hide one significant warning.
Dann Corbit
Posts: 12542
Joined: Wed Mar 08, 2006 8:57 pm
Location: Redmond, WA USA

Re: quick question about compiling Stockfish with icc

Post by Dann Corbit »

Justin Sherron wrote:Thanks for the clarification. It was my first attempt at compiling with something other than gcc, which never produced similar messages during my experience.
If you use gcc with the flags:

-Wwrite-strings -Wcast-qual -Wshadow -Wconversion -W -Wall -ansi -pedantic

as I do, you will see that it screams as loud and often as icc does. Incidentally, you should strive to understand what the warnings mean and then check each and every one of them to ensure that they are spurious. (I admit that I do not always check every warning on projects written by other people but I sometimes do. However, I always check every warning on my own code.).

The first type of warning up above is designed to show problems like this:

int int_value = 23456789;
char char_value = int_value; /* Compiler complains about losing significant bits. If you print char_value you will see it is not the same as int_value for obvious reasons. */

The above type of assignment is safe if and only if the contents of int_value are less than or equal to CHAR_MAX and greater than or equal to CHAR_MIN as defined in limits.h.

As an exercise, you might include <assert.h> and then put an assert on each assignment that gets a warning to see if there really is a problem. Then do a debug build and run some chess contests with the debug engine. Once in a while you will find a real bug by doing this.
Mincho Georgiev
Posts: 454
Joined: Sat Apr 04, 2009 6:44 pm
Location: Bulgaria

Re: quick question about compiling Stockfish with icc

Post by Mincho Georgiev »

In the last update (at least ICC for Windows), the #2259 remark is only enabled at warning level 5.
Justin Sherron
Posts: 29
Joined: Thu Mar 04, 2010 11:35 pm

Re: quick question about compiling Stockfish with icc

Post by Justin Sherron »

Dann Corbit wrote: If you use gcc with the flags...you will see that it screams as loud and often as icc does.
Interesting,...I guess I've been blissfully unaware of this during my limited experience. I simply chose not to question gcc when the output always looked so nice and clean. :lol:

And I admittedly agree with your suggestion that I should familiarize myself more thoroughly with terms/techniques. Unfortunately, being a molecular biologist means that my formal training with computers/programming is virtually non-existent. My own personal training as a hobbyist, though, has been very, umm, perhaps I'll say "casual." "Casual" sounds much better than "slow and inefficient." :wink: But if anyone can recommend some good educational texts for a newbie, I'd gladly take suggestions.
Dann Corbit
Posts: 12542
Joined: Wed Mar 08, 2006 8:57 pm
Location: Redmond, WA USA

Re: quick question about compiling Stockfish with icc

Post by Dann Corbit »

Justin Sherron wrote:
Dann Corbit wrote: If you use gcc with the flags...you will see that it screams as loud and often as icc does.
Interesting,...I guess I've been blissfully unaware of this during my limited experience. I simply chose not to question gcc when the output always looked so nice and clean. :lol:

And I admittedly agree with your suggestion that I should familiarize myself more thoroughly with terms/techniques. Unfortunately, being a molecular biologist means that my formal training with computers/programming is virtually non-existent. My own personal training as a hobbyist, though, has been very, umm, perhaps I'll say "casual." "Casual" sounds much better than "slow and inefficient." :wink: But if anyone can recommend some good educational texts for a newbie, I'd gladly take suggestions.
If you want to learn C, I would recommend :
http://en.wikipedia.org/wiki/The_C_Prog ... age_(book)

If you want to learn C++, I would recommend :
http://en.wikipedia.org/wiki/The_C%2B%2 ... g_Language
User avatar
michiguel
Posts: 6401
Joined: Thu Mar 09, 2006 8:30 pm
Location: Chicago, Illinois, USA

Re: quick question about compiling Stockfish with icc

Post by michiguel »

Dann Corbit wrote:
Justin Sherron wrote:
Dann Corbit wrote: If you use gcc with the flags...you will see that it screams as loud and often as icc does.
Interesting,...I guess I've been blissfully unaware of this during my limited experience. I simply chose not to question gcc when the output always looked so nice and clean. :lol:

And I admittedly agree with your suggestion that I should familiarize myself more thoroughly with terms/techniques. Unfortunately, being a molecular biologist means that my formal training with computers/programming is virtually non-existent. My own personal training as a hobbyist, though, has been very, umm, perhaps I'll say "casual." "Casual" sounds much better than "slow and inefficient." :wink: But if anyone can recommend some good educational texts for a newbie, I'd gladly take suggestions.
If you want to learn C, I would recommend :
http://en.wikipedia.org/wiki/The_C_Prog ... age_(book)
I absolutely second the motion.

If only one more book needs to be read I recommend
http://en.wikipedia.org/wiki/The_Practi ... rogramming

Very concise and touches many general issues such as debugging, optimization, writing your own tools etc.

A freebie that is good (I read it years ago from the library but now is online)
http://publications.gbdirect.co.uk/c_book/

As a big reference, Dann is too humble to recommend it but I will:
http://www.amazon.com/C-Unleashed-Richa ... 0672318962

Miguel
PS: Justin, I am a biochemist so I can relate to you. You do not need to be a computer scientist to have fun.

If you want to learn C++, I would recommend :
http://en.wikipedia.org/wiki/The_C%2B%2 ... g_Language
Justin Sherron
Posts: 29
Joined: Thu Mar 04, 2010 11:35 pm

Re: quick question about compiling Stockfish with icc

Post by Justin Sherron »

Thanks for the suggestions. I'll give 'em a whirl and see what I can learn.