Skip to content

Commit

Permalink
keys.c: disable -Warray-bounds warning from gcc >= 8. seems bogus.
Browse files Browse the repository at this point in the history
keys.c: In function 'Char_Console':
keys.c:469:4: warning: 'memmove' offset [-2147483647, -1] is out of the bounds [0, 16384] of object 'key_lines' with type 'char[64][256]' [-Warray-bounds]
    memmove (workline + 1, workline, len);
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
keys.c:31:7: note: 'key_lines' declared here
 char  key_lines[CMDLINES][MAXCMDLINE];
       ^~~~~~~~~
  • Loading branch information
sezero committed Feb 10, 2024
1 parent 4c130ca commit 951a071
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions Quake/keys.c
Original file line number Diff line number Diff line change
Expand Up @@ -466,7 +466,13 @@ void Char_Console (int key)
workline[MAXCMDLINE - 2] = 0;
workline += key_linepos;
len = strlen(workline) + 1;
#if defined(__GNUC__) && (__GNUC__ > 7)
#pragma GCC diagnostic ignored "-Warray-bounds"
#endif
memmove (workline + 1, workline, len);
#if defined(__GNUC__) && (__GNUC__ > 7)
#pragma GCC diagnostic pop
#endif
*workline = key;
}
else
Expand Down

0 comments on commit 951a071

Please sign in to comment.