gcc ICE if I do: ================ $ m6811-elf-gcc -c -O3 -fomit-frame-pointer -m68hc12 -mshort a.cpp $ m6811-elf-gcc -c -O2 -fomit-frame-pointer -m68hc12 -mshort a.cpp Here is a ICE msg: ================== a.cpp: In function `int test(int, char**)': a.cpp:59: error: insn does not satisfy its constraints: (insn:HI 318 546 324 17 (set (mem/s:QI (symbol_ref:HI ("*_ZZ4testiPPcE5wrbuf") <var_decl 0x400bbbd0 wrbuf>) [0 wrbuf+0 S1 A8]) (mem:QI (plus:HI (reg/f:HI 3 sp) (const_int 16 [0x10])) [21 S1 A8])) 30 {*movqi_68hc12} (insn_list 317 (nil)) (nil)) a.cpp:59: internal compiler error: in reload_cse_simplify_operands, at postreload.c:378 Please submit a full bug report, with preprocessed source if appropriate. See <URL:http://gcc.gnu.org/bugs.html> for instructions. Here is a 'a.cpp': ================== typedef unsigned int size_t; extern "C" void *memcpy(void *__dest, const void *__src, size_t __n); extern "C" int strcmp(const char *__s, const char *__t); extern "C" int printf(const char *__format, ...); extern void writebuf(const unsigned char *, unsigned short); volatile unsigned char busy; inline static unsigned char isBusy() { return busy; } int test(int argc, char *argv[]) { static unsigned char buf[8], wrbuf[3]; static unsigned short addr; if (argc > 1 && !strcmp(argv[1], "wr")) { addr = 0x0000; memcpy(buf, (unsigned char*)0x3000, sizeof(buf)); for (unsigned char i = 0; i < sizeof(buf); ++i) { wrbuf[0] = (unsigned char) (addr >> 8); wrbuf[1] = (unsigned char) addr; wrbuf[2] = buf[i]; while (isBusy()); writebuf(wrbuf, 3); ++addr; } } else if (argc > 1 && !strcmp(argv[1], "wr1")) { memcpy(buf, (unsigned char*)(0x3000 + sizeof(buf)), sizeof(buf)); addr = 0x0008; for (unsigned char i = 0; i < sizeof(buf); ++i) { wrbuf[0] = (unsigned char) (addr >> 8); wrbuf[1] = (unsigned char) addr; wrbuf[2] = buf[i]; while (isBusy()); writebuf(wrbuf, 3); ++addr; } } else if (argc > 1 && !strcmp(argv[1], "wr2")) { printf("wr: %x\n", *(unsigned short*)(&buf[0])); for (unsigned char i = 0; i < 2; ++i) { wrbuf[0] = (unsigned char) (addr >> 8); wrbuf[1] = (unsigned char) addr; wrbuf[2] = buf[i]; while (isBusy()); writebuf(wrbuf, 3); ++addr; } } return 0; } Environment: System: Linux namsh 2.6.5-rc2 #68 Mon Mar 22 10:33:09 KST 2004 i686 athlon i386 GNU/Linux Architecture: i686 host: i686-pc-linux-gnu build: i686-pc-linux-gnu target: m6811-unknown-none configured with: ../configure --disable-nls --target=m6811-elf --prefix=/usr/GNUHCS --program-prefix=m6811-elf- --with-gnu-ld --with-gnu-as --disable-shared --enable-languages=c,c++ --without-headers --with-newlib How-To-Repeat: Compile the 'a.cpp' with a given compile option.
Fix: Change the compile option. For example: 1. Use '-O1' instead of '-O2' or '-O3'. 2. Do not use '-fomit-frame-pointer'.
Can you try a newer compiler than 2.95.3, like say 3.3.3?
Oops! It was 3.4.0. I don't know why reported version is 2.95. The reported version should be 3.4.0-20040319 (because report time is 20040322). At this time, I use 3.4.0-20040326. And with this 3.4.0-20040326, The result is same. I could see same ICE msg.
By the way, I have another ICE sample which generates almost same ICE. Should I opened a new bug? I had several ICE samples before, but I didn't report if I see I already report almost same error. 20040407.c: In function `vsnprintf': 20040407.c:136: error: insn does not satisfy its constraints: (insn 856 855 419 49 20040407.c:119 (set (reg:QI 14 *_.d1) (mem:QI (plus:HI (reg/f:HI 3 sp) (const_int 32 [0x20])) [13 S1 A8])) 30 {*movqi_68hc12} (nil) (nil)) 20040407.c:136: internal compiler error: in reload_cse_simplify_operands, at postreload.c:378 Please submit a full bug report, with preprocessed source if appropriate. See <URL:http://gcc.gnu.org/bugs.html> for instructions.
Going to check.
It seems this bug was fixed. Today, I made the m6811-elf-gcc from CVS. $ m6811-elf-gcc --version m6811-elf-gcc (GCC) 3.4.3 20041013 (prerelease) ... No more ICE. I didn't use m6811-elf-gcc recently. The previous version I had is 3.4.1 20040607.
Closing as fixed in 3.4.3, then.