From Bugzilla Helper: User-Agent: Mozilla/4.6 [en-gb]C-CCK-MCD NetscapeOnline.co.uk (Win98; I) Description of problem: Hello there, I have just tried to compile kakasi-2.3.4-8 from Redhat 8.0 Here are some of the messages the compiler produces cc: Info: k2.c, line 157: In this statement, an array is being accessed outside the bounds specified for the array type. (subscrbounds) cc: Info: libk2.c, line 157: In this statement, an array is being accessed outside the bounds specified for the array type. (subscrbounds) Here is an untested patch to shut up the compiler. ./src/k2.c.old ./src/k2.c *** ./src/k2.c.old Sun Dec 15 18:14:11 2002 --- ./src/k2.c Sun Dec 15 18:17:04 2002 *************** *** 140,146 **** static struct k2rom_tbl *k2rom_ptr; struct k2rom_tbl *p; int i, clen, ylen; ! char buffer[k2rom_buflen]; unsigned char c1; int max_match, match_more; char *max_romaji; --- 140,146 ---- static struct k2rom_tbl *k2rom_ptr; struct k2rom_tbl *p; int i, clen, ylen; ! char buffer[ k2rom_buflen + 1]; unsigned char c1; int max_match, match_more; char *max_romaji; ./lib/libk2.c.old ./lib/libk2.c Version-Release number of selected component (if applicable): How reproducible: Always Steps to Reproduce: 1. compile with any C compiler that sanity checks array indices, such as Compaq. 2. 3. Additional info:
I not sure whether it's happened at this point, but right now I don't think kakasi still has a problem. although 'buffer' is actually allocated for k2rom_buflen(10) spaces, and basically it allows to use 9 spaces for something and 1 space for null string. So: buffer[k2rom_buflen] = '\0'; clen = k2rom_buflen; for (i = 0; i < k2rom_buflen; ++ i) { these codes are fine. I can't see any codes to be having the problems. I think that's a compiler bug or excessive warning.
I can't believe your answer. It is standard C that if an array of size 'n' is declared, then the array index 'n' should not be used. Lower limits are inclusive, upper limits are exclusive. I strongly recommend reading page 22, section 1.6, of Kernighan & Ritchie Edition 2, the standard book on the C programming language.
You are right. I was confused.
fixed in 2.3.4-11