Ticket #48849

gcc-14: city_from_wonder() out-of-bounds array subscript

Open Date: 2023-10-16 03:50 Last Update: 2023-10-18 00:33

Reporter:
Owner:
Type:
Status:
Closed
Component:
MileStone:
Priority:
5 - Medium
Severity:
5 - Medium
Resolution:
Fixed
File:
1

Details

gcc-14 development version, S3_1:

../../../src/common/improvement.c: In function 'city_from_wonder':
../../../src/common/improvement.c:874:33: error: array subscript -1 is below array bounds of 'const int[200]' [-Werror=array-bounds=]
  874 |   int city_id = pplayer->wonders[improvement_index(pimprove)];
      |                 ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from ../../../src/common/game.h:35,
                 from ../../../src/common/improvement.c:27:
../../../src/common/player.h:301:7: note: while referencing 'wonders'
  301 |   int wonders[B_LAST];              /* contains city id's, WONDER_NOT_BUILT,

Ticket History (3/4 Histories)

2023-10-16 03:50 Updated by: cazfi
  • New Ticket "gcc-14: city_from_wonder() out-of-bounds array subscript" created
2023-10-16 03:59 Updated by: cazfi
  • Owner Update from (None) to cazfi
  • Resolution Update from None to Accepted
  • Milestone Update from (None) to 3.0.9 (closed)
Comment

Patch for all branches, including S2_6, attached.

2023-10-18 00:33 Updated by: cazfi
  • Status Update from Open to Closed
  • Resolution Update from Accepted to Fixed

Edit

Please login to add comment to this ticket » Login