Incidencia #47662

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

Abrir Fecha: 2023-03-23 21:13 Última actualización: 2023-04-25 21:37

Informador:
Propietario:
(Ninguno)
Tipo:
Estado:
Open
Componente:
Hito:
(Ninguno)
Prioridad:
5 - Medium
Gravedad:
5 - Medium
Resolución:
Ninguno
Fichero:
Ninguno

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 History (3/6 Histories)

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

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 Updated by: cazfi
Comentario

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 Updated by: cazfi
Comentario

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 Updated by: cazfi
  • Hito Update from (Ninguno) to 3.0.8 (cerrado)
  • Prioridad Update from 5 - Medium to 6
Comentario

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 Updated by: cazfi
  • Hito Update from 3.0.8 (cerrado) to (Ninguno)
  • Componente Update from Server to General
  • Prioridad Update from 6 to 5 - Medium
Comentario

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

Attachment File List

No attachments

Editar

Please login to add comment to this ticket » Entrar