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

iteration 84 invokes undefined behavior #961

Open
th-otto opened this issue Mar 20, 2024 · 0 comments
Open

iteration 84 invokes undefined behavior #961

th-otto opened this issue Mar 20, 2024 · 0 comments

Comments

@th-otto
Copy link
Contributor

th-otto commented Mar 20, 2024

When activating warnings, i get

In file included from /home/sebilla/atari/Vanilla-Conquer/redalert/function.h:108,
                 from /home/sebilla/atari/Vanilla-Conquer/redalert/cell.cpp:79:
In member function ‘int HouseClass::QuantityB(int)’,
    inlined from ‘bool CellClass::Goodie_Check(FootClass*)’ at /home/sebilla/atari/Vanilla-Conquer/redalert/cell.cpp:2367:62:
/home/sebilla/atari/Vanilla-Conquer/redalert/house.h:991:33: warning: iteration 84 invokes undefined behavior [-Waggressive-loop-optimizations]
  991 |         return (BQuantity[index]);
      |                                 ^
/home/sebilla/atari/Vanilla-Conquer/redalert/cell.cpp: In member function ‘bool CellClass::Goodie_Check(FootClass*)’:
/home/sebilla/atari/Vanilla-Conquer/redalert/cell.cpp:2366:47: note: within this loop
 2366 |                                 for (j = 0; j < STRUCT_COUNT; j++) {
      |                                             ~~^~~~~~~~~~~~~~

at

for (j = 0; j < STRUCT_COUNT; j++) {

This is because that array has different sizes depending on FIXIT_ANTS/FIXIT_CSII being defined. Same may also be true for the other arrays.

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