ALERT! Stay away from patched gcc's (was Re: 2.0.22 will be the last version)

Linus Torvalds (
Sat, 28 Sep 1996 16:57:30 +0300 (EET DST)

On Thu, 26 Sep 1996, Dr. Werner Fink wrote:
> Hmm --- my system (asus sp3g, ncr53c810 on board, amd5x86-P75, 1G SCSI-Disk,
> SCSI-CDROM) is not able to boot 2.0.21 nor 2.0.20.
> Note: 2.0.0 up to 2.0.18 boots without any problem and 2.0.18 is really
> stable. All kernels are optimized for i486 and 53c7,8xx is used.

Ok, I asked Werner to send me a disassembly of the affected function, and he
definitely had some bad code produced by his compiler for the new inline
assembly code to handle semaphores.

If you have problems booting 2.0.19+, make _sure_ you have a good gcc. I
personally use stock 2.7.2, and that is known to be ok. The bad compiler was
also based on gcc-2.7.2, but had some patches applied (at least a "bugfix"
for the strength-reduce bug, and it may be that that "bugfix" has bad side
effects, but I have yet to hear back whether that was the only patch).

Now, the code that I saw in his disassembled version of that function makes
me suspect that there might be other problems with the inline assembly used
by the kernel (not all of them might be this obvious: this particular bug was
100% certain to lead to a crash in that particular function the second time
it was called).

There is at least _one_ reasonably recent version of gcc out there that
provably produces bad code when it comes to inline asm register clobbers, and
I'd ask people to take a hard look at their compiler if they don't have a
unpatched gcc. It looks like the standard gcc's are ok, but I wonder about
gcc- (which reportedly also fixes the strength-reduce bug, and if they
used the same bugfix as Werners version did, it may be suspect).