adafruit / ArduinoCore-samd

116 stars 119 forks source link

Build warnings -- [-Wmaybe-uninitialized] #250

Open henrygab opened 4 years ago

henrygab commented 4 years ago

Note that this template is re-used across multiple classes. This may increase difficulty of avoiding regressions when fixing this issue.

Simplified log

.../USBHost/src/parsetools.h:
    In member function 'uint32_t HIDBoot<BOOT_PROTOCOL>::Init(uint32_t, uint32_t, uint32_t)
    [with unsigned char BOOT_PROTOCOL = 1]':

.../USBHost/src/parsetools.h:47:33:
    warning: '*((void*)(& confDescrParserB)+8).MultiValueBuffer::valueSize' may be used uninitialized in this function
    [-Wmaybe-uninitialized]
   47 |   countDown = valueSize = pbuf->valueSize;
      |                           ~~~~~~^~~~~~~~~

.../USBHost/src/parsetools.h:
    In member function 'uint32_t HIDBoot<BOOT_PROTOCOL>::Init(uint32_t, uint32_t, uint32_t)
    [with unsigned char BOOT_PROTOCOL = 2]':

.../USBHost/src/parsetools.h:47:33:
    warning: '*((void*)(& confDescrParserB)+8).MultiValueBuffer::valueSize' may be used uninitialized in this function
    [-Wmaybe-uninitialized]
   47 |   countDown = valueSize = pbuf->valueSize;
      |                           ~~~~~~^~~~~~~~~

.../USBHost/src/parsetools.h:
    In member function 'virtual uint32_t ADK::Init(uint32_t, uint32_t, uint32_t)':

.../USBHost/src/parsetools.h:47:33:
    warning: '*((void*)(& confDescrParser)+8).MultiValueBuffer::valueSize' may be used uninitialized in this function
    [-Wmaybe-uninitialized]
   47 |   countDown = valueSize = pbuf->valueSize;
      |                           ~~~~~~^~~~~~~~~

See example logs at https://github.com/adafruit/ArduinoCore-samd/runs/965558867

-Wmaybe-uninitialized information

The compiler believes (but cannot prove) that uninitialized memory is likely to be used.

Interpretation

tbd

Recommendation

tbd