An upgraded gcc gave me an array-bound violation warning in 
src/bus/sh7750r.c, line 104:

for (i = 0; i < 8; i++) {
     sprintf( buff, "WE%d", i );
     failed |= generic_bus_attach_sig( part, &(WE[i]), buff );
}

gcc is right, WE (alias for bus->params->we) is declared in bus_params_t 
as field signal_t *we[4].

Inspection also shows that field d in the bus_params_t, which is 
declared as d[64], is never accessed beyond [31], so I'd guess (but I 
don't know this bus at all) it had as well be declared as d[32].

Personally, I prefer all accesses to whole arrays in this way:
   for (i = 0; i < sizeof WE / sizeof WE[0]; i++)
etc etc, to lower the chance of array bound violations.

Is it OK if I change this file in this way and commit?

Rutger

------------------------------------------------------------------------------
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing
http://p.sf.net/sfu/novell-sfdev2dev
_______________________________________________
UrJTAG-development mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/urjtag-development

Reply via email to