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

Discussion of chess software programming and technical issues.

Moderators: hgm, Dann Corbit, Harvey Williamson

Forum rules
This textbox is used to restore diagrams posted with the [d] tag before the upgrade.
Post Reply
User avatar
pocopito
Posts: 238
Joined: Tue Jul 12, 2011 11:31 am
Contact:

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

Post by pocopito » Sat Jul 26, 2014 11:29 am

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: 3184
Joined: Mon May 31, 2010 11:29 am
Full name: lucasart
Contact:

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

Post by lucasart » Sat Jul 26, 2014 2:04 pm

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 9:39 pm
Location: Brasilia DF Brazil
Contact:

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

Post by laoliveirajr » Sat Jul 26, 2014 3:28 pm

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 1:48 pm

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

Post by rbarreira » Sat Jul 26, 2014 5:00 pm

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 1:48 pm

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

Post by rbarreira » Sat Jul 26, 2014 5:54 pm

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: 20923
Joined: Mon Feb 27, 2006 6:30 pm
Location: Birmingham, AL

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

Post by bob » Sat Jul 26, 2014 11:02 pm

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: 20923
Joined: Mon Feb 27, 2006 6:30 pm
Location: Birmingham, AL

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

Post by bob » Sat Jul 26, 2014 11:03 pm

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: 188
Joined: Sat Mar 11, 2006 7: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 » Sat Aug 02, 2014 10:49 am

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: 4906
Joined: Tue Feb 28, 2012 10:56 pm

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

Post by syzygy » Sat Aug 02, 2014 12:20 pm

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: 20923
Joined: Mon Feb 27, 2006 6:30 pm
Location: Birmingham, AL

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

Post by bob » Sat Aug 02, 2014 3:10 pm

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?

Post Reply