任务单 #47662

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

开放日期: 2023-03-23 21:13 最后更新: 2023-04-25 21:37

报告人:
属主:
(无)
类型:
状态:
开启
组件:
里程碑:
(无)
优先:
5 - Medium
严重性:
5 - Medium
处理结果:
文件:

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.

任务单历史 (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
评论

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
评论

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
评论

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
  • 里程碑 Update from (无) to 3.0.8 (关闭)
  • 优先 Update from 5 - Medium to 6
评论

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
  • 里程碑 Update from 3.0.8 (关闭) to (无)
  • 组件 Update from Server to General
  • 优先 Update from 6 to 5 - Medium
评论

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

Attachment File List

No attachments

编辑

Please login to add comment to this ticket » 登录名