Open leonty opened 1 year ago
It looks like the array-bounds check assumes that accessing memory by a pointer is actually accessing an array of length 0. As far as I understood, the min-pagesize option removes all such warnings, not only false positive. I think in this case it makes sense to wait for the ticket resolution first.
Does it work for you to add "--param=min-pagesize=0" into AVR Helper settings at User or Workspace level for the time being?
Well, you are right that this option should be activated by default because it would hide real bug related to array length. But it would be convenient to implement easier way to activate the option, let's say, with a checkbox in the extension settings. No hope that that avr-gcc ticket will be resolved soon since it's almost a year that it has been opened and still stays in "NEW" status.
Adding the parameter works well both at User or Workspace level of the extension settings.
The latest avr-gcc 12.2.0 emits warnings like "main.cpp:52:12: warning: array subscript 0 is outside array bounds of "volatile uint8_t [0]" [-Warray-bounds]" for valid code like "CLKMSR = 0b01;". Not sure if they finally call it a bug in gcc or not, but for now these warnings can be avoided by adding the option "--param=min-pagesize=0" to avr-gcc call to indicate that zero is a valid address. So this option could be a default one for avr-gcc calls.
See https://gcc.gnu.org/bugzilla//show_bug.cgi?id=105523