When compiling binutils for the sh4-elf target, the following error occurs: ../../src/binutils-2.20.1/gas/config/tc-sh.c: In function 'find_cooked_opcode': ../../src/binutils-2.20.1/gas/config/tc-sh.c:2540:7: error: array subscript is above array bounds Upon closer inspection, it seems to be due to the line: name[nlen] = 0; name is declared as a char[20], and the previous for loop describes name < 20 as one of the predicates. A fix for this would involve either changing name to be a char[21] instead, or perhaps changing the predicate in the loop to be name < (sizeof (name) - 1). I'm not familiar enough with the binutils source to comment on which would be the more suitable option.
Note: I'm using gcc 4.5.0 to compile binutils. I strongly suspect that this sort of check was only added recently, as I've compiled binutils for sh4-elf before without issue.
Subject: Bug 11733 CVSROOT: /cvs/src Module name: src Changes by: amodra@sourceware.org 2010-06-21 07:42:55 Modified files: gas : ChangeLog gas/config : tc-sh.c Log message: PR gas/11733 * config/tc-sh.c (find_cooked_opcode): Correct array bounds check. Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/src/gas/ChangeLog.diff?cvsroot=src&r1=1.4172&r2=1.4173 http://sourceware.org/cgi-bin/cvsweb.cgi/src/gas/config/tc-sh.c.diff?cvsroot=src&r1=1.137&r2=1.138
Fixed mainline