SvarDOS / bugz

SvarDOS bug tracker
http://svardos.org/
6 stars 0 forks source link

UTF8TOCP compiler warning with GCC 14.2 #128

Closed boeckmann closed 1 month ago

boeckmann commented 1 month ago

Is it the right places to report this? There is also something on sourceforge. Is the source on sourceforge the current one? Seems so judging by the last commit date.

cc utf8tocp.c -o utf8tocp -Wall -pedantic -Wextra -O3 -std=c89 -Wformat-security
utf8tocp.c: In Funktion »loadlookuptable.constprop«:
utf8tocp.c:158:28: Warnung: Arrayindex -125 ist außerhalb der Arraygrenzen von »short unsigned int[128]« [-Warray-bounds=]
  158 |     lookuptable[128 - 253] = 0x20AC;      /* add the euro sign */
      |     ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~
utf8tocp.c:646:25: Anmerkung: an Offset -250 des Objekts »lookuptable« der Größe 256
  646 |   static unsigned short lookuptable[128] = {
      |                         ^~~~~~~~~~~
./utf8tocp > utf8tocp.txt
boeckmann commented 1 month ago

English message:

cc utf8tocp.c -o utf8tocp -Wall -pedantic -Wextra -O3 -std=c89 -Wformat-security
utf8tocp.c: In function 'loadlookuptable.constprop':
utf8tocp.c:158:28: warning: array subscript -125 is outside array bounds of 'short unsigned int[128]' [-Warray-bounds=]
  158 |     lookuptable[128 - 253] = 0x20AC;      /* add the euro sign */
      |     ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~
utf8tocp.c:646:25: note: at offset -250 into object 'lookuptable' of size 256
  646 |   static unsigned short lookuptable[128] = {
      |                         ^~~~~~~~~~~
./utf8tocp > utf8tocp.txt
mateuszviste commented 1 month ago

Is it the right places to report this?

No idea. Who knows. Important thing is it gets to the proper person. :)

Is the source on sourceforge the current one?

Yes, utf8tocp is hosted on sourceforge.

array subscript -125 is outside array bounds

Thanks! Fixed on trunk. Weird that earlier gcc weren't spotting this obvious issue.