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

Florian La Roche (
30 Sep 1996 12:03:42 +0200

Henrik Storner <> wrote:
> In linux.kernel writes:

> >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.
> [snip]
> >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).

> Just for the record, I am running 2.0.21 compiled with on a
> near-identical system to Werner Fink's: AMD 5x83-133, asus pvi-486sp3,
> ncr 53c810, 1 Gb Conner SCSI disk and SCSI cd-rom. So far it's been up
> three days without problems.

> I have been using the 2.7.2.l3 un-official snapshot (by H.J.Lu) for a
> while, also without problems, but recently upgraded to the official

I have digged out the patches that were probably used for Werner's gcc.
They contain only a fix for "loop.c", but are otherwise unchanged.
Maybe Werner has build his own C compiler with further patches. I know
that he uses a different "specs" file, that may contain settings that
cause problems with 2.7.2.
He probably uses binutils
(Most of this is speculation, as Werner has just left for vacation...)

Here is that patch for 2.7.2. The full patches are uploaded to

--- loop.c
+++ loop.c 1996/01/10 12:38:18
@@ -6190,6 +6190,11 @@
if (invariant_p (arg) == 1)
+#if 0 /* Linear transformations of the compared values
+ are incorrect unless it can be verified that
+ overflow behaviour stays the same for all possible
+ values of the loop bound, for all iterations. */
/* Look for giv with constant positive mult_val and nonconst
add_val. Insert insns to compute new compare value. */

@@ -6216,6 +6221,7 @@
if (apply_change_group ())
return 1;

/* This code has problems. Basically, you can't know when

I will look at some assembly output from this compiler today and
see, if I can find some miscompiled places.
If I find any problems, I'll write again to linux-kernel.

Florian La Roche