[Freeciv-tickets] [freeciv] #48248: gcc-14: connection list size array subscript warning

Back to archive index
OSDN Ticket System norep****@osdn*****
Thu Jun 15 19:16:38 JST 2023


#48248: gcc-14: connection list size array subscript warning

  Open Date: 2023-06-15 13:16
Last Update: 2023-06-15 13:16

URL for this Ticket:
    https://osdn.net//projects/freeciv/ticket/48248
RSS feed for this Ticket:
    https://osdn.net/ticket/ticket_rss.php?group_id=12505&tid=48248

---------------------------------------------------------------------

Last Changes/Comment on this Ticket:
2023-06-15 13:16 Updated by: cazfi
 * New Ticket "gcc-14: connection list size array subscript warning" created


---------------------------------------------------------------------
Ticket Status:

      Reporter: cazfi
         Owner: (None)
          Type: Bugs
        Status: Open
      Priority: 5 - Medium
     MileStone: 3.0.8
     Component: Server
      Severity: 5 - Medium
    Resolution: None
---------------------------------------------------------------------

Ticket details:

Building S3_0 with gcc-14 development version:
../../../src/server/sernet.c: In function 'send_ping_times_to_all':
../../../src/server/sernet.c:1471:23: error: array subscript 320 is above array bounds of 'int[320]' [-Werror=array-bounds=]
 1471 |     packet.conn_id_new[i] = pconn->id;
      |     ~~~~~~~~~~~~~~~~~~^~~
In file included from ../../../src/common/networking/packets.h:90,
                 from ../../../src/common/game.h:36,
                 from ../../../src/server/sernet.c:75:
../../../src/common/packets_gen.h:818:7: note: while referencing 'conn_id_new'
  818 |   int conn_id_new[MAX_NUM_CONNECTIONS];
      |       ^~~~~~~~~~~
../../../src/server/sernet.c:1472:23: error: array subscript 320 is above array bounds of 'float[320]' [-Werror=array-bounds=]
 1472 |     packet.ping_time_6[i] = pconn->ping_time;
      |     ~~~~~~~~~~~~~~~~~~^~~
../../../src/common/packets_gen.h:820:9: note: while referencing 'ping_time_6'
  820 |   float ping_time_6[MAX_NUM_CONNECTIONS];
      |         ^~~~~~~~~~~
cc1: all warnings being treated as errors
We do have an assert checking that there should never be more than MAX_NUM_CONNECTIONS rounds in the iteration, but that doesn't count as "protection" against the case the way the compiler would want.

-- 
Ticket information of Freeciv project
Freeciv Project is hosted on OSDN

Project URL: https://osdn.net/projects/freeciv/
OSDN: https://osdn.net

URL for this Ticket:
    https://osdn.net/projects/freeciv/ticket/48248
RSS feed for this Ticket:
    https://osdn.net/ticket/ticket_rss.php?group_id=12505&tid=48248



More information about the Freeciv-tickets mailing list
Back to archive index