Subject: Re: EGCS 1.1 UPDATE rev. 3
To: Todd Vierling <tv@pobox.com>
From: Jason Thorpe <thorpej@nas.nasa.gov>
List: tech-toolchain
Date: 08/18/1998 10:19:41
On Tue, 18 Aug 1998 09:58:55 -0400 (EDT) 
 Todd Vierling <tv@pobox.com> wrote:

 > - i386: Working, reported by <thorpej@netbsd.org>.

Not quite working, as I ran into a problem last night.

You may have noticed that I committed a few things to the tree last night
that avoid VERY BOGUS -Wuninitialized warnings (i.e. they are completely
incorrect) ... I would like to back those parts out, eventually...

All of them seem to have to do with egcs not quite dealing with __noreturn__
attribute.

Except for one...

While building pmap.new.c:

cc -g -O2 -Werror -Wall -Wmissing-prototypes -Wstrict-prototypes -Wno-main -I. -I../../../../arch -I../../../.. -nostdinc -DLKM -DSYSVMSG -DSYSVSEM -DSYSVSHM -DCCDNBUF="0x10" -DMSGBUFSIZE="0x8000" -DBUFPAGES="0xc80" -DCOMPAT_43 -DFIFO -DNMBCLUSTERS="0x1000" -DDIAGNOSTIC -DMAXUSERS=32 -D_KERNEL  -Di386  -c ../../../../arch/i386/i386/pmap.new.c
cc1: warnings being treated as errors
../../../../arch/i386/i386/pmap.new.c: In function `pmap_remove_ptes':
../../../../arch/i386/i386/pmap.new.c:1519: warning: `prevptr' might be used uninitialized in this function
../../../../arch/i386/i386/pmap.new.c:1519: warning: `pve' might be used uninitialized in this function
../../../../arch/i386/i386/pmap.new.c: In function `pmap_remove_pte':
../../../../arch/i386/i386/pmap.new.c:1519: warning: `prevptr' might be used uninitialized in this function
../../../../arch/i386/i386/pmap.new.c:1519: warning: `pve' might be used uninitialized in this function
*** Error code 1

Stop.

If you look at the source file, here is the function it's complaining about
(according to variable names and line numbers):

__inline static struct pv_entry *pmap_remove_pv(pvh, pmap, va)
 
struct pv_head *pvh;
struct pmap *pmap;
vaddr_t va;
 
{
  struct pv_entry *pve, **prevptr;
 
  prevptr = &pvh->pvh_list;             /* previous pv_entry pointer */  
  pve = *prevptr;
  while (pve) {
    if (pve->pv_pmap == pmap && pve->pv_va == va) {     /* match? */
      *prevptr = pve->pv_next;          /* remove it! */
      break;
    } 
    prevptr = &pve->pv_next;            /* previous pointer */
    pve = pve->pv_next;                 /* advance */
  }
  return(pve);                          /* return removed pve */
} 


Please note the following problems:

	(1) IT GOT THE NAME OF THE FUNCTION WRONG!  The name of the
	    function is actually "pmap_remove_pv", but egcs reported
	    "pmap_remove_ptes".

	(2) The first thing the function does is initialize the variables
	    it is complaining are uninitialized!

Compiling WITHOUT -O2 allows the file to be compiled.  I suspect this would
be the case with the other uninitialized warnings which I encountered last
night (but didn't check, because I wanted to go to sleep at some point :-)

Jason R. Thorpe                                       thorpej@nas.nasa.gov
NASA Ames Research Center                            Home: +1 408 866 1912
NAS: M/S 258-5                                       Work: +1 650 604 0935
Moffett Field, CA 94035                             Pager: +1 650 940 5942