Subject: Re: PROBLEMS WITH GCC 2.7.2/I386 ON APPLICATIONS
To: None <niklas@appli.se>
From: der Mouse <mouse@Collatz.McRCIM.McGill.EDU>
List: current-users
Date: 04/13/1996 12:29:58
>> There has been quite a bit of talk about the optimization code in
>> gcc 2.7.2 and its guilt in a number of problems compiling and using
>> the kernel.
> "A number of problems"?  This statement startles me.

Well, I had to remove -O from the kernel Makefiles entirely on my sun3
because it kept bugchecking.  And now, even without -O, I get

cc  -Werror -msoft-float -I. -I../../../../arch -I../../../.. -DNEWCONFIG -DMACHINE_NONCONTIG -DTIMEZONE="0" -DDST="0" -DGENERIC -DFPU_EMULATE -DHAVECACHE -DSWAPPAGER -DVNODEPAGER -DDEVPAGER -DKTRACE -DDDB -DNFSSERVER -DNFSCLIENT -DFFS -DCD9660 -DFDESC -DFIFO -DKERNFS -DNULLFS -DPROCFS -DUNION -DINET -DNFS_BOOT_RWSIZE="0x400" -DCOMPAT_SUNOS -DCOMPAT_10 -DCOMPAT_11 -DCOMPAT_43 -DTCP_COMPAT_42 -DUCONSOLE -DPMAP_DEBUG -DDIAGNOSTIC -DSCSIDEBUG -D_KERNEL -Dmc68020 -Dsun3  -c ../../../../kern/kern_synch.c
cc: Internal compiler error: program cc1 got fatal signal 6
*** Error code 1

Stop.

At first I took this for another instance of the "everything dumps
core" bug, but investigation proved it was not so.

kern_synch.c is

/*      $NetBSD: kern_synch.c,v 1.35 1996/02/09 18:59:50 christos Exp $ */

with the following patch applied:

--- OLD/sys/kern/kern_synch.c	Thu Jan  1 00:00:00 1970
+++ NEW/sys/kern/kern_synch.c	Thu Jan  1 00:00:00 1970
@@ -599,8 +599,8 @@
 				rlim->rlim_cur += 5;
 		}
 	}
-	if (s > 10 * 60 && p->p_ucred->cr_uid && p->p_nice == NZERO) {
-		p->p_nice = NZERO + 4;
+	if (autonicetime && s > autonicetime && p->p_ucred->cr_uid && p->p_nice == NZERO) {
+		p->p_nice = autoniceval;
 		resetpriority(p);
 	}
 

The resulting file has md5 checksum e66c3128adec286dba586ec32673a6cf.
I see the same problem with the unpatched file, md5 checksum
a952c379b902b148121688fa4744df26.  cc --version reports "2.7.2", and it
has been patched to disable the signed-versus-unsigned warning:

--- OLD/gnu/usr.bin/gcc/common/c-typeck.c	Thu Jan  1 00:00:00 1970
+++ NEW/gnu/usr.bin/gcc/common/c-typeck.c	Thu Jan  1 00:00:00 1970
@@ -2492,6 +2492,7 @@
 	      /* Do the checking based on the original operand trees, so that
 		 casts will be considered, but default promotions won't be.  */
 
+#if 0 /* this is more obnoxious than useful, especially without a way to turn it off */
 	      /* Do not warn if the comparison is being done in a signed type,
 		 since the signed type will only be chosen if it can represent
 		 all the values of the unsigned type.  */
@@ -2519,6 +2520,7 @@
 		/* OK */;
 	      else
 		warning ("comparison between signed and unsigned");
+#endif
 
 	      /* Warn if two unsigned values are being compared in a size
 		 larger than their original size, and one (and only one) is the

I'm going to see if an up-to-date source tree exhibits the same
problem...

					der Mouse

			    mouse@collatz.mcrcim.mcgill.edu