$ mipsel-linux-gnu-gcc -v Using built-in specs. Target: mipsel-linux-gnu Configured with: /home/andre/toolchain/bs_build_4.3-20080111/gcc-4.3-20080111/configure --prefix=/usr/local/mipsel_amd64/4.3-20080111-bare --target=mipsel-linux-gnu --enable-languages=c --enable-checking=no --with-gnu-as --with-gnu-ld --with-newlib --disable-libada --disable-libgomp --disable-libssp --disable-nls --disable-multilib --disable-shared --disable-threads --with-tune=mips32r2 --with-gmp=/usr/local/mipsel_amd64/4.3-20080111-bare --with-mpfr=/usr/local/mipsel_amd64/4.3-20080111-bare Thread model: single gcc version 4.3.0 20080111 (experimental) (GCC)
$ cat badmips16.c void foo (unsigned long base, unsigned char *dst, unsigned int count) { while (count && ((unsigned long) dst) & 0x03) { count--; *dst++ = *((volatile unsigned char *) base); } while (count >= 4) { count -= 4; *dst = *((volatile unsigned int *) base); dst += 4; } } $ mipsel-linux-gnu-gcc -Os -mips16 -march=mips32r2 -mno-abicalls -c badmips16.c $ mipsel-linux-gnu-objdump -d badmips16.o badmips16.o: file format elf32-tradlittlemips Disassembly of section .text: 00000000 <foo>: 0: 1004 b a <foo+0xa> 2: a440 lbu v0,0(a0) 4: 4eff addiu a2,-1 6: c540 sb v0,0(a1) 8: 4d01 addiu a1,1 a: 2608 beqz a2,1c <foo+0x1c> c: 6a03 li v0,3 e: eaac and v0,a1 10: 2af8 bnez v0,2 <foo+0x2> 12: 1004 b 1c <foo+0x1c> 14: 9c40 lw v0,0(a0) 16: 4efc addiu a2,-4 18: c540 sb v0,0(a1) 1a: 4d04 addiu a1,4 1c: 5e04 sltiu a2,4 1e: 60fa bteqz 14 <foo+0x14> 20: e8a0 jrc ra 22: 6500 nop ... ... Bug: The branch instruction at offset 0x12 is in the branch delay slot of the bnez instruction at offset 0x10. -- Summary: [4.3.0 20080111] mips16 : branch in branch delay slot Product: gcc Version: 4.3.0 Status: UNCONFIRMED Severity: major Priority: P3 Component: c AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: armcc2000 at yahoo dot com GCC build triplet: x86_64-unknown-linux-gnu GCC host triplet: x86_64-unknown-linux-gnu GCC target triplet: mipsel-unknown-linux-gnu http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34845