Ticket #47662

./common/city.c integer overflow ... cannot be represented in type 'int'

Eröffnet am: 2023-03-23 21:13 Letztes Update: 2023-04-25 21:37

Auswertung:
Verantwortlicher:
(Keine)
Typ:
Status:
Offen
Komponente:
Meilenstein:
(Keine)
Priorität:
5 - Mittel
Schweregrad:
5 - Mittel
Lösung:
Keine
Datei:
Keine

Details

3.0.6 clang

This one is a bit weird : the value are always (-1 billion + epsilon) * 100 , and show identical values in different random games

Count of errors :

      7 ../../common/city.c:2880:37: runtime error: signed integer overflow: -999999992 * 100 cannot be represented in type 'int'      ### ~ 50 max_int
      5 ../../common/city.c:2880:37: runtime error: signed integer overflow: -999999991 * 100 cannot be represented in type 'int'
      4 ../../common/city.c:2880:37: runtime error: signed integer overflow: -999999994 * 100 cannot be represented in type 'int'
      3 ../../common/city.c:2880:37: runtime error: signed integer overflow: -999999987 * 100 cannot be represented in type 'int'

      6 ../../common/city.c:2873:25: runtime error: signed integer overflow: -999999990 * 100 cannot be represented in type 'int'
      6 ../../common/city.c:2873:25: runtime error: signed integer overflow: -999999989 * 100 cannot be represented in type 'int'
      3 ../../common/city.c:2873:25: runtime error: signed integer overflow: -999999994 * 100 cannot be represented in type 'int'
      3 ../../common/city.c:2873:25: runtime error: signed integer overflow: -999999993 * 100 cannot be represented in type 'int'
      3 ../../common/city.c:2873:25: runtime error: signed integer overflow: -999999987 * 100 cannot be represented in type 'int'

      6 > ../../common/city.c:2866:21: runtime error: signed integer overflow: -999999992 * 100 cannot be represented in type 'int'
      3 > ../../common/city.c:2866:21: runtime error: signed integer overflow: -999999994 * 100 cannot be represented in type 'int'
      3 > ../../common/city.c:2866:21: runtime error: signed integer overflow: -999999991 * 100 cannot be represented in type 'int'
      3 > ../../common/city.c:2866:21: runtime error: signed integer overflow: -999999987 * 100 cannot be represented in type 'int'

I'll try to investigate a bit and provide saved games.

Ticket-Verlauf (3/6 Historien)

2023-03-23 21:13 Aktualisiert von: alain_bkr
  • New Ticket "./common/city.c integer overflow ... cannot be represented in type 'int'" created
2023-04-12 13:35 Aktualisiert von: cazfi
Kommentar

Possibly related assert failure on a S3_1 (+ local patches) autogame:

in city_build_building() [../../src/server/cityturn.c::2412]: assertion 'pcity->surplus[O_SHIELD] >= 0' failed.

2023-04-13 02:56 Aktualisiert von: cazfi
Kommentar

Reply To cazfi

Possibly related assert failure on a S3_1 (+ local patches) autogame: {{{ in city_build_building() [../../src/server/cityturn.c::2412]: assertion 'pcity->surplusO_SHIELD >= 0' failed. }}}

I don't know *exact* reason of this, but seems to be related to the mess of what upkeep gets paid pack when unit gets removed from the game. I think gold upkeep is the only form of upkeep that actually gets paid back. But even when unit dies for lack of gold, it does not pay back shields or food. Additional complication is that unit dying for lack of shields does so by "Help Wonder" or "Disband Unit Recover Production" meaning that often city's negative shield stock still gets turned positive by that death (but not as much as it should).

2023-04-18 17:40 Aktualisiert von: cazfi
Kommentar

I'm now getting that assert failure quite regularly. Either it's recently introduced bug, or the other changes have made AI much more likely to proceed to a situation where it triggers it (in an autogame)

2023-04-24 04:36 Aktualisiert von: cazfi
  • Meilenstein Update from (Keine) to 3.0.8 (closed)
  • Priorität Update from 5 - Mittel to 6
Kommentar

Reply To cazfi

I'm now getting that assert failure quite regularly.

Frequently enough to consider this a regression blocking 3.0.8. ( #47779 )

2023-04-25 21:37 Aktualisiert von: cazfi
  • Meilenstein Update from 3.0.8 (closed) to (Keine)
  • Komponente Update from Server to General
  • Priorität Update from 6 to 5 - Mittel
Kommentar

The assert is unrelated to the original problem after all -> split to #47938

Dateianhangliste

Keine Anhänge

Bearbeiten

Please login to add comment to this ticket » Anmelden