I'm using gcc 4.5 to build my Systemz code and am getting statement 10 flagged 
as possibly out of bounds. The code is in 
$SRC/cmd/abi/appcert/static_prof/static_prof.c around line 127:

01  bktno = (bktno + 1) % DEFBKTS;
02 for (i = bktno; i < DEFBKTS; i = (i + 1) % DEFBKTS) {
03   if (i == orig_bktno) {
04    table_full = TRUE;
05    exit(1);
06   }
07   if (!bkts[i].sym)
08    break;
09  }
10  if ((!bkts[i].sym) && (table_full != 1)) {

In statement 10 it is possible for i to be == 24997 and thus out of bounds as 
the loop may have exited because the bound was reached not only because the 
break at line 08 was encountered. Should line 10 read:

if ((i < DEFBKTS) && (!bkts[i].sym) && (table_full != 1)) {

The warning certainly disappears when I do this. (Warning is flagged under gcc 
4.4.2 too.)

Neale
-- 
This message posted from opensolaris.org
_______________________________________________
opensolaris-code mailing list
opensolaris-code@opensolaris.org
http://mail.opensolaris.org/mailman/listinfo/opensolaris-code

Reply via email to