Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(serial): warning Warray-bounds #1964

Merged
merged 1 commit into from
Mar 8, 2023
Merged

Conversation

fpistm
Copy link
Member

@fpistm fpistm commented Mar 7, 2023

when USB CDC enabled and generic Serial

In member function 'void HardwareSerial::setRx(uint32_t)',
    inlined from 'HardwareSerial::HardwareSerial(void*, HalfDuplexMode_t)' at C:\Users\<user>\AppData\Local\Arduino15\packages\STMicroelectronics\hardware\stm32\2.5.0-dev\cores\arduino\HardwareSerial.cpp:137:10:
C:\Users\<user>\AppData\Local\Arduino15\packages\STMicroelectronics\hardware\stm32\2.5.0-dev\cores\arduino\HardwareSerial.cpp:573:18: warning: array subscript 'HardwareSerial[0]' is partly outside array bounds of 'USBSerial [1]' [-Warray-bounds]
  573 |   _serial.pin_rx = digitalPinToPinName(_rx);
In file included from C:\Users\<user>\AppData\Local\Arduino15\packages\STMicroelectronics\hardware\stm32\2.5.0-dev\cores\arduino\WSerial.h:6,
                 from C:\Users\<user>\AppData\Local\Arduino15\packages\STMicroelectronics\hardware\stm32\2.5.0-dev\cores\arduino\wiring.h:48,
                 from C:\Users\<user>\AppData\Local\Arduino15\packages\STMicroelectronics\hardware\stm32\2.5.0-dev\cores\arduino\Arduino.h:36,
                 from C:\Users\<user>\AppData\Local\Arduino15\packages\STMicroelectronics\hardware\stm32\2.5.0-dev\cores\arduino\HardwareSerial.cpp:26:
C:\Users\<user>\AppData\Local\Arduino15\packages\STMicroelectronics\hardware\stm32\2.5.0-dev\cores\arduino\USBSerial.h: In constructor 'HardwareSerial::HardwareSerial(void*, HalfDuplexMode_t)':
C:\Users\<user>\AppData\Local\Arduino15\packages\STMicroelectronics\hardware\stm32\2.5.0-dev\cores\arduino\USBSerial.h:72:18: note: object 'SerialUSB' of size 16
   72 | extern USBSerial SerialUSB;

when USB CDC enabled and generic Serial

warning: array subscript 'HardwareSerial[0]' is partly outside array bounds of 'USBSerial [1]' [-Warray-bounds]

Signed-off-by: Frederic Pillon <frederic.pillon@st.com>
@fpistm fpistm added the fix 🩹 Bug fix label Mar 7, 2023
@fpistm fpistm added this to the 2.5.0 milestone Mar 7, 2023
@fpistm fpistm merged commit 343c091 into stm32duino:main Mar 8, 2023
@fpistm fpistm deleted the fix_serialUSB branch March 8, 2023 13:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fix 🩹 Bug fix
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant