Subject: Preliminary test of i386 kernel compiling with GCC 4.0
To: None <tech-kern@netbsd.org>
From: Vincent <10.50@free.fr>
List: tech-kern
Date: 10/05/2004 21:35:41
Hi,
I just downloaded and set up the future GCC 4.0 and tried it with the 
kernel.

I have several 'variable not initialized' warnings in the netinet code, 
and a lot of 'warning: pointer targets in assignment differ in 
signedness', which is a warning that does not appear on gcc 3.4.2, and 
some 'left-hand operand of comma expression has no effect'.

Anyhow, the compiler fails on an internal error somewhere later:


../../../../kern/kern_lock.c:233: internal compiler error: in 
gimplify_expr, at gimplify.c:3975

which appears to be a macro: INTERLOCK_RELEASE(lkp, LK_SPIN, *s);

and another error somewhere later, which appears to be more interessing :

../../../../kern/sysv_msg.c:84: error: static declaration of 'msgpool' 
follows non-static declaration
../../../../sys/msg.h:200: error: previous declaration of 'msgpool' was here
../../../../kern/sysv_msg.c:85: error: static declaration of 'msgmaps' 
follows non-static declaration
../../../../sys/msg.h:201: error: previous declaration of 'msgmaps' was here
../../../../kern/sysv_msg.c:86: error: static declaration of 'msghdrs' 
follows non-static declaration
../../../../sys/msg.h:202: error: previous declaration of 'msghdrs' was here

Same thing in sysv_sem.c, in dev/wsfont/wsfont.c, in dev/pckbport/pckbport.c

gcc 3.4.2 compiles all those files OK.

Linking an hybrid kernel compiled with gcc 4.0 and gcc 3.4.2 where the 
former fails gives a fairly reduced sized image (about 5-6 % less space 
than a gcc-3.3.3 build) that unfortunately doesn't boot: although the 
kernel in itself seems to work and detect peripherals, it cannot attach 
neither /dev/console, neither find /sbin/init, and falls back in db.

At this time, I have no precise figure to give about a performance 
increase in userland (GCC 4.0 is supposed to feature a new and very 
aggressive optimizer), but I might perform some try if you care.

Vincent