Skip to content

Conversation

Willmac16
Copy link
Contributor

Existing implementation accessed memory it shouldn't, and didn't write both values to the target uint16_t.

Existing implementation accessed memory it shouldn't, and didn't write both values to the target uint16_t.
@Willmac16
Copy link
Contributor Author

For reference, when the original code is run, my compiler spits out:

.pio/libdeps/teensymm/SX1509 IO Expander/src/SparkFunSX1509.cpp: In member function 'bool SX1509::readPin(uint8_t, bool*)':
.pio/libdeps/teensymm/SX1509 IO Expander/src/SparkFunSX1509.cpp:789:26: warning: array subscript 1 is outside array bounds of 'uint16_t [1]' {aka 'short unsigned int [1]'} [-Warray-bounds]
  789 |                 value[1] = dest[0];
      |                 ~~~~~~~~~^~~~~~~~~
.pio/libdeps/teensymm/SX1509 IO Expander/src/SparkFunSX1509.cpp:212:18: note: while referencing 'tempRegDir'
  212 |         uint16_t tempRegDir;

@PaulZC
Copy link
Contributor

PaulZC commented Apr 28, 2025

Hi @Willmac16 ,

Thank you for this. Merging...

Best wishes,
Paul

@PaulZC PaulZC merged commit 523e4fe into sparkfun:master Apr 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants