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

warning: 'indices' may be used uninitialized #2063

Closed
lmoureaux opened this issue Nov 27, 2023 · 0 comments · Fixed by #2066
Closed

warning: 'indices' may be used uninitialized #2063

lmoureaux opened this issue Nov 27, 2023 · 0 comments · Fixed by #2066
Labels
bug Something isn't working gui This issue requires changes to the user interface

Comments

@lmoureaux
Copy link
Contributor

Describe the bug

Spotted on msys2:

[354/509] Building CXX object client/CMakeFiles/freeciv21-client.dir/tileset/layer_terrain.cpp.obj
D:/a/freeciv21/freeciv21/client/tileset/layer_terrain.cpp: In member function 'void freeciv::layer_terrain::fill_terrain_sprite_array(std::vector<drawn_sprite>&, const tile*, const terrain*, terrain**) const':
D:/a/freeciv21/freeciv21/client/tileset/layer_terrain.cpp:993:43: warning: 'indices' may be used uninitialized [-Wmaybe-uninitialized]
  993 |       int array_index = flattened_index<2>(info.matches_with.size(),
      |                         ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
  994 |                                            {indices[1], indices[0]}, i);
      |                                            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
D:/a/freeciv21/freeciv21/client/tileset/layer_terrain.cpp:959:26: note: 'indices' declared here
  959 |       std::array<int, 2> indices;
      |                          ^~~~~~~
D:/a/freeciv21/freeciv21/client/tileset/layer_terrain.cpp:993:43: warning: 'indices' may be used uninitialized [-Wmaybe-uninitialized]
  993 |       int array_index = flattened_index<2>(info.matches_with.size(),
      |                         ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
  994 |                                            {indices[1], indices[0]}, i);
      |                                            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
D:/a/freeciv21/freeciv21/client/tileset/layer_terrain.cpp:959:26: note: 'indices' declared here
  959 |       std::array<int, 2> indices;
      |                          ^~~~~~~

Link to CI build

@lmoureaux lmoureaux added bug Something isn't working gui This issue requires changes to the user interface labels Nov 27, 2023
lmoureaux added a commit to lmoureaux/freeciv21 that referenced this issue Nov 27, 2023
lmoureaux added a commit that referenced this issue Nov 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working gui This issue requires changes to the user interface
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant