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

emonTx34_CM - for loop out of bounds #16

Open
stuartpittaway opened this issue Sep 10, 2023 · 0 comments
Open

emonTx34_CM - for loop out of bounds #16

stuartpittaway opened this issue Sep 10, 2023 · 0 comments

Comments

@stuartpittaway
Copy link

Receiving a compile warning in emonTx34_CM and emonLibCM.

The for loop is defined for 6 iterations, but the wh_CT[] array is only sized to 5 items.

Linking .pio\build\default\firmware.elf
C:\Users\stuar\.platformio\packages\framework-arduino-avr\cores\arduino\main.cpp: In function 'main':
.pio\libdeps\default\EmonLibCM\emonLibCM.cpp:415:20: warning: iteration 5 invokes undefined behavior [-Waggressive-loop-optimizations]
     wh_CT[channel] = _wh;
                    ^
E:/source/emontx3/firmware/emonTx34/emonTx34_CM/emonTx34_CM_config.ino:417:25: note: within this loop
         for (byte n=0; n<6; n++)
                         ^
Checking size .pio\build\default\firmware.elf
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

No branches or pull requests

1 participant