Page 4 of 4
Re: gcc4.8 outperforming gcc5, gcc6, gcc7
Posted: Tue Nov 28, 2017 8:32 pm
by AndrewGrant
That would be because of the patch I pushed yesterday... to allow indexing that array when in check (which means depth could be < 0).
I'm surprised I don't get these errors when I run my program through valgrind / gdb
Re: gcc4.8 outperforming gcc5, gcc6, gcc7
Posted: Tue Nov 28, 2017 8:36 pm
by Ras
AndrewGrant wrote:I'm surprised I don't get these errors when I run my program through valgrind / gdb
Valgrind isn't really useful with local or global variables. gdb doesn't report an error because that access is still within valid memory. I think the access returns 8 because right before that, there is LateMovePruningDepth.
And for O3, I have seen GCC blowing up the program and becoming slower because the bigger program exceeded some CPU caches.
Re: gcc4.8 outperforming gcc5, gcc6, gcc7
Posted: Wed Nov 29, 2017 12:21 am
by AndrewGrant
Testing the results of the fix for this mistake. The patch that introduced this bug was a good +10ELO
Seems like this bug was really holding the original patch back. I'll run a test with my normal TC 5+.05s and 20+.2s before I commit
depth_bug_fix
SPRT @ 2.0+0.02s with 1MB Hash
LLR: 2.96 (-2.94, 2.94) [0.00, 5.00]
Games: 5100 W: 1626 L: 1465 D: 2009
ELO: 10.97
This also has fixed my issue with PGO build differing from nonPGO.
Thank you for taking the time and tracking this down. I'll be sure to mention you when I commit the fix.
If you want actual contribution credits IE submit a PR, that can be done aswell
Re: gcc4.8 outperforming gcc5, gcc6, gcc7
Posted: Wed Nov 29, 2017 1:09 am
by syzygy
AndrewGrant wrote:Thank you for taking the time and tracking this down. I'll be sure to mention you when I commit the fix.
If you want actual contribution credits IE submit a PR, that can be done aswell
If you mean me, please don't bother!
You were going to try -fsantize=undefined anyway as you posted 4 minutes before my post. When I saw that I felt a bit bad that I had not let you discover it yourself! It is quite amazing to have such a tool that easily saves you many hours of debugging.
So the credits should go to the developers of -fsanitize.
Re: gcc4.8 outperforming gcc5, gcc6, gcc7
Posted: Wed Nov 29, 2017 4:55 pm
by Dann Corbit
AndrewGrant wrote:That would be because of the patch I pushed yesterday... to allow indexing that array when in check (which means depth could be < 0).
I'm surprised I don't get these errors when I run my program through valgrind / gdb
You can check array bounds manually:
Code: Select all
assert(index >= 0);
assert(index < 64);
piece[index] = aPiece;
color[index] = aColor;
I have macros that I use for array bounds checks. I can't seem to find my macro set right now, but this is the general idea:
Code: Select all
#include <assert.h>
#include <stdlib.h>
#define single_dim_check( a, x ) ( (assert( (x >= 0 ) && (sizeof a / sizeof a[0] > x ) ) )
int main(void)
{
int a[5];
size_t index = 6;
single_dim_check(a,index);
return 0;
}