Bug 14678 - m68hc11-elf-gcc ICE
Summary: m68hc11-elf-gcc ICE
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: target (show other bugs)
Version: 3.4.0
: P3 normal
Target Milestone: 3.4.3
Assignee: Stephane Carrez
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-03-22 08:41 UTC by namsh
Modified: 2004-10-13 11:56 UTC (History)
1 user (show)

See Also:
Host: i686-pc-linux-gnu
Target: m68hc11
Build: i686-pc-linux-gnu
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description namsh 2004-03-22 08:41:10 UTC
    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.
Comment 1 namsh 2004-03-22 08:41:10 UTC
Fix:
	Change the compile option. For example:
	1.  Use '-O1' instead of '-O2' or '-O3'.
	2.  Do not use '-fomit-frame-pointer'.
Comment 2 Andrew Pinski 2004-04-07 03:14:05 UTC
Can you try a newer compiler than 2.95.3, like say 3.3.3?
Comment 3 namsh 2004-04-07 03:23:02 UTC
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.
Comment 4 namsh 2004-04-07 03:27:31 UTC
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.
Comment 5 Stephane Carrez 2004-06-06 17:08:46 UTC
Going to check.
Comment 6 namsh 2004-10-13 06:48:29 UTC
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.
Comment 7 Giovanni Bajo 2004-10-13 11:56:29 UTC
Closing as fixed in 3.4.3, then.