Linus on gcc-4.9: "your compiler is pure and utter *shi

Discussion of chess software programming and technical issues.

Moderators: hgm, Rebel, chrisw

User avatar
pocopito
Posts: 238
Joined: Tue Jul 12, 2011 1:31 pm

Linus on gcc-4.9: "your compiler is pure and utter *shi

Post by pocopito »

I just stumbled on this:
https://lkml.org/lkml/2014/7/24/584

Just a sample:
"Ok, so I'm looking at the code generation and your compiler is pure
and utter *shit*.
Adding Jakub to the cc, because gcc-4.9.0 seems to be terminally broken.
Lookie here, your compiler does some absolutely insane things with the
spilling, including spilling a *constant*."

Best

E Diaz
Two first meanings of the dutch word "leren":
1. leren [vc] (learn, larn, acquire) acquire or gain knowledge or skills.
2. leren [v] (teach, learn, instruct) impart skills or knowledge to.
User avatar
lucasart
Posts: 3232
Joined: Mon May 31, 2010 1:29 pm
Full name: lucasart

Re: Linus on gcc-4.9: "your compiler is pure and utter

Post by lucasart »

pocopito wrote:I just stumbled on this:
https://lkml.org/lkml/2014/7/24/584

Just a sample:
"Ok, so I'm looking at the code generation and your compiler is pure
and utter *shit*.
Adding Jakub to the cc, because gcc-4.9.0 seems to be terminally broken.
Lookie here, your compiler does some absolutely insane things with the
spilling, including spilling a *constant*."

Best

E Diaz
Linus is probably right, but that doesn't mean gcc 4.9 is "terminally broken". It's a bug, and it will be fixed. Life goes on.

Anyway, it's good to know, so people don't update too quickly to 4.9. I'm still on 4.8.3, and it's working very well.
Theory and practice sometimes clash. And when that happens, theory loses. Every single time.
laoliveirajr
Posts: 138
Joined: Tue Sep 25, 2012 11:39 pm
Location: Brasilia DF Brazil

Re: Linus on gcc-4.9: "your compiler is pure and utter

Post by laoliveirajr »

Here, Capivara was compiled with gcc-4.9.0 very well, at Debian 64-bit.

Some problems only with "cilk_spawn", for now ...
rbarreira
Posts: 900
Joined: Tue Apr 27, 2010 3:48 pm

Re: Linus on gcc-4.9: "your compiler is pure and utter

Post by rbarreira »

I don't think anyone compiles their chess engines with -mno-red-zone, so I don't think you should worry too much about this, unless this bug also happens in other ways not illustrated in that email.

As for the constant spilling, that's just a performance problem, not a functional bug.
rbarreira
Posts: 900
Joined: Tue Apr 27, 2010 3:48 pm

Re: Linus on gcc-4.9: "your compiler is pure and utter

Post by rbarreira »

Actually after reading this:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61904

And the similar bug linked there, I think the problem is also present in gcc 4.5.0 through 4.8.3, as well as 4.9.0 and 4.9.1. And it seems to be possible even without -mno-red-zone.

On the good side, it seems to be caused by the options -g and -fvar-tracking, which are rare in released binaries.
bob
Posts: 20943
Joined: Mon Feb 27, 2006 7:30 pm
Location: Birmingham, AL

Re: Linus on gcc-4.9: "your compiler is pure and utter

Post by bob »

laoliveirajr wrote:Here, Capivara was compiled with gcc-4.9.0 very well, at Debian 64-bit.

Some problems only with "cilk_spawn", for now ...
If you read the post by Torvalds, it is unlikely 4.9 will _break_ your code, unless you are using the redzone option he mentioned. But things like spilling a constant to memory is not exactly an efficient use of an instruction cycle. It might be generating some pretty ugly code.

Sometimes compilers go ape. MSVC has done similar things in the past...
bob
Posts: 20943
Joined: Mon Feb 27, 2006 7:30 pm
Location: Birmingham, AL

Re: Linus on gcc-4.9: "your compiler is pure and utter

Post by bob »

rbarreira wrote:I don't think anyone compiles their chess engines with -mno-red-zone, so I don't think you should worry too much about this, unless this bug also happens in other ways not illustrated in that email.

As for the constant spilling, that's just a performance problem, not a functional bug.
The optimization that spilled a constant to memory was unrelated to the no-red-zone option. That's certainly broken. The no-red-zone option was actually producing code that crashed which is a show-stopper. But unnecessary memory writes are never good for a chess program.
User avatar
Bo Persson
Posts: 243
Joined: Sat Mar 11, 2006 8:31 am
Location: Malmö, Sweden
Full name: Bo Persson

Re: Linus on gcc-4.9: "your compiler is pure and utter

Post by Bo Persson »

lucasart wrote:
pocopito wrote:I just stumbled on this:
https://lkml.org/lkml/2014/7/24/584

Just a sample:
"Ok, so I'm looking at the code generation and your compiler is pure
and utter *shit*.
Adding Jakub to the cc, because gcc-4.9.0 seems to be terminally broken.
Lookie here, your compiler does some absolutely insane things with the
spilling, including spilling a *constant*."

Best

E Diaz
Linus is probably right, but that doesn't mean gcc 4.9 is "terminally broken". It's a bug, and it will be fixed. Life goes on.
Members of the gcc team have clarified that this bug has been reported and fixed even before Linus noticed the problem. So much for "terminally broken".
syzygy
Posts: 5557
Joined: Tue Feb 28, 2012 11:56 pm

Re: Linus on gcc-4.9: "your compiler is pure and utter

Post by syzygy »

Bo Persson wrote:Members of the gcc team have clarified that this bug has been reported and fixed even before Linus noticed the problem.
But less than 2 weeks before he reported it, while the bug apparently has been there since gcc-4.5 (released 14 April 2010). The bug has not been fixed in any released version of gcc.

I agree "terminally broken" isn't very meaningful, but that's Linus on lkml.
bob
Posts: 20943
Joined: Mon Feb 27, 2006 7:30 pm
Location: Birmingham, AL

Re: Linus on gcc-4.9: "your compiler is pure and utter

Post by bob »

Bo Persson wrote:
lucasart wrote:
pocopito wrote:I just stumbled on this:
https://lkml.org/lkml/2014/7/24/584

Just a sample:
"Ok, so I'm looking at the code generation and your compiler is pure
and utter *shit*.
Adding Jakub to the cc, because gcc-4.9.0 seems to be terminally broken.
Lookie here, your compiler does some absolutely insane things with the
spilling, including spilling a *constant*."

Best

E Diaz
Linus is probably right, but that doesn't mean gcc 4.9 is "terminally broken". It's a bug, and it will be fixed. Life goes on.
Members of the gcc team have clarified that this bug has been reported and fixed even before Linus noticed the problem. So much for "terminally broken".
Linus reported two "bugs". One was the "red-zone" problem. The other was spilling a constant to memory. Were BOTH fixed, or just the red-zone problem?