GOB: Fix SaveLoad_v7 initialization#6624
Merged
sdelamarre merged 1 commit intoscummvm:masterfrom May 19, 2025
Merged
Conversation
orgads
referenced
this pull request
May 16, 2025
The initialization order must match exactly the order of _saveFiles.
Discovered by GCC warning on release:
engines/gob/save/saveload_v7.cpp: In constructor 'Gob::SaveLoad_v7::SaveLoad_v7(Gob::GobEngine*, const char*)':
engines/gob/save/saveload_v7.cpp:1466:45: warning: iteration 9 invokes undefined behavior [-Waggressive-loop-optimizations]
1466 | _saveFiles[index++].handler = _addy4GrundschuleHandler[i] = new FakeFileHandler(_vm);
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
engines/gob/save/saveload_v7.cpp:1465:27: note: within this loop
1465 | for (int i = 0; i < 11; i++)
| ~~^~~~
Amends 7e3ec46.
Contributor
Author
|
ping |
Contributor
|
Oops, many thanks for catching this. This fix will invalidate some existing save files (that were created with a bad name), but fortunately the most important ones, like the score in Read/Count exercises were not in the scrambled parts. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The initialization order must match exactly the order of _saveFiles.
Discovered by GCC warning on release:
Amends 7e3ec46.