Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Fix compiler warning on HardwareTimer#2256

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
fpistm merged 2 commits intostm32duino:mainfromldursw:patch-1
Jan 23, 2024
Merged

Fix compiler warning on HardwareTimer#2256

fpistm merged 2 commits intostm32duino:mainfromldursw:patch-1
Jan 23, 2024

Conversation

ldursw
Copy link
Contributor

This PR fixes a compiler warning when compiling with-O3. There's no bounds check inpauseChannel, which causes this warning. Adding the bounds check fixes the warning.

framework-arduinoststm32\libraries\SrcWrapper\src\HardwareTimer.cpp: In member function 'void HardwareTimer::pauseChannel(uint32_t)':framework-arduinoststm32\libraries\SrcWrapper\src\HardwareTimer.cpp:203:31: warning: array subscript 4 is above array bounds of 'TimerModes_t [4]' [-Warray-bounds]  203 |   if (_ChannelMode[channel - 1] == TIMER_INPUT_FREQ_DUTY_MEASUREMENT) {      |       ~~~~~~~~~~~~~~~~~~~~~~~~^In file included from framework-arduinoststm32\cores\arduino\stm32/analog.h:45,                 from framework-arduinoststm32\cores\arduino/board.h:8,                 from framework-arduinoststm32\cores\arduino/wiring.h:40,                 from framework-arduinoststm32\cores\arduino/Arduino.h:36,                 from framework-arduinoststm32\libraries\SrcWrapper\src\HardwareTimer.cpp:26:framework-arduinoststm32\cores\arduino/HardwareTimer.h:188:19: note: while referencing 'HardwareTimer::_ChannelMode'  188 |     TimerModes_t  _ChannelMode[TIMER_CHANNELS];      |                   ^~~~~~~~~~~~framework-arduinoststm32\libraries\SrcWrapper\src\HardwareTimer.cpp:203:31: warning: array subscript 4 is above array bounds of 'TimerModes_t [4]' [-Warray-bounds]  203 |   if (_ChannelMode[channel - 1] == TIMER_INPUT_FREQ_DUTY_MEASUREMENT) {      |       ~~~~~~~~~~~~~~~~~~~~~~~~^framework-arduinoststm32\cores\arduino/HardwareTimer.h:188:19: note: while referencing 'HardwareTimer::_ChannelMode'  188 |     TimerModes_t  _ChannelMode[TIMER_CHANNELS];      |                   ^~~~~~~~~~~~

Signed-off-by: ldursw <37294448+ldursw@users.noreply.github.com>
@fpistmfpistm added the fix 🩹Bug fix labelJan 23, 2024
@fpistmfpistm added this to the2.8.0 milestoneJan 23, 2024
@fpistmfpistm self-requested a reviewJanuary 23, 2024 09:03
Signed-off-by: Frederic Pillon <frederic.pillon@st.com>
@fpistm
Copy link
Member

Hi@ldursw
thanks for the PR.

@fpistmfpistm merged commitde1e1c5 intostm32duino:mainJan 23, 2024
@ldurswldursw deleted the patch-1 branchJanuary 23, 2024 15:49
tadtruex pushed a commit to TadAtThayer/Arduino_Core_STM32 that referenced this pull requestApr 23, 2024
Signed-off-by: ldursw <37294448+ldursw@users.noreply.github.com>Co-authored-by: Frederic Pillon <frederic.pillon@st.com>
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@fpistmfpistmfpistm approved these changes

Assignees
No one assigned
Labels
fix 🩹Bug fix
Projects
Milestone
2.8.0
Development

Successfully merging this pull request may close these issues.

2 participants
@ldursw@fpistm

[8]ページ先頭

©2009-2025 Movatter.jp