Bogus warning is perhaps from new alias analysis

Iain McClatchie iain@mcclatchie.com
Sun Sep 6 00:12:00 GMT 1998


Mark,

I think I've found a possible problem in the new alias analysis code.
The following routine emits an incorrect warning, which I think stems
from the new alias analysis.

If the problem is in alias analysis, then analysis is conservative,
so I suppose this is not a high priority bug.  The problem seems
to go away if I delete seemingly unrelated things, so I thought it
might be programming error rather than a limitation of the alias
analysis algorithm.

Thanks for all the great work.

-Iain McClatchie

[iain@gw1 ~/try]$ gcc -V egcs-2.91.57 -O2 -c -W alias.cc
alias.cc: In function `void get_assert_inputs(int)':
alias.cc:15: warning: `long int signum' might be used uninitialized in
this function
[iain@gw1 ~/try]$ gcc -V egcs-2.91.02 -O2 -c -W alias.cc


Here's alias.cc:
class sigevent_list2 {
public:
  long *shift( void );
};

void
get_assert_inputs( int depth )
{
  sigevent_list2        thislist;
  long          *event;
  int            i;
  int              nphases;

  for( i = 0; i < depth; i++ ) {
    long signum = i + depth;
    if( signum > 10 ) {
      nphases = signum;
      goto GOTIT;
    }
  }
  exit( 1 );
GOTIT:
  for( i = 0; i < nphases; i++ ) {
  }
  for( event = thislist.shift(); event; event = thislist.shift()) {
  }
}



More information about the Gcc-bugs mailing list