[Bug target/14629] New: ICE on c++ source

gcc-bugzilla at gcc dot gnu dot org gcc-bugzilla@gcc.gnu.org
Thu Mar 18 11:49:00 GMT 2004


    ICE occurs if I do
    ===================
	$ m6811-elf-gcc -c -o a.o a.cpp -m68hc12 -mshort -fomit-frame-pointer -O1
    or
	$ m6811-elf-gcc -c -o a.o a.cpp -m68hc12 -mshort -fomit-frame-pointer -O2 -msoft-reg-count=32

    Here is a ICE msg:
    ===================
	a.cpp: In member function `unsigned char CFrame::OnRxChar(unsigned char)':
	a.cpp:47: error: unable to find a register to spill in class `A_OR_SP_REGS'
	a.cpp:47: error: this is the insn:
	(insn:HI 98 96 99 11 a.cpp:40 (set (reg/f:HI 68)
		(plus:HI (mem/s:HI (reg/v/u/f:HI 54 [ this ]) [4 <variable>.m_rxBuf+0 S2 A8])
		    (reg:HI 1 d [orig:65 <variable>.m_rxCnt ] [65]))) 50 {*addhi3_68hc12} (insn_list 93 (nil))
	    (nil))
	a.cpp:47: confused by earlier errors, bailing out


    Here is a 'a.cpp':
    ===================
	extern void Hex2Ascii(unsigned char,unsigned char*);
	extern void cputch(char);
	class CFrame {
	protected:
	    unsigned char *m_rxBuf;
	    unsigned int m_frameLen;
	    unsigned char OnRxChar(unsigned char __c);
	private:
	    unsigned int m_rxCnt;
	    unsigned char m_state;
	};

	unsigned char
	CFrame::OnRxChar(unsigned char c)
	{
	    switch (m_state)
	    {
		case 0:
		    m_rxCnt = 0;
		    m_state = 1;

		case 1:
		    if (c == 0x5a)
		    {
			++m_rxCnt;
			if (m_rxCnt == 2)
			    m_state = 2;
		    }
		    else
		    {
			char buf[2];
			Hex2Ascii(c, (unsigned char*)buf);
			cputch(buf[0]);
			cputch(buf[1]);
			m_rxCnt = 0;
		    }
		    break;

		case 2:
		    m_rxBuf[m_rxCnt++] = c;
		    if (m_rxCnt == (unsigned int) 7)
			m_frameLen = *(unsigned short*)(&m_rxBuf[4]);
		    break;
	    }

	    return 0;
	}

Environment:
System: Linux namsh 2.6.5-rc1 #67 Wed Mar 17 12:40:07 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 given compiler option.
------- Additional Comments From namsh at kldp dot org  2004-03-18 11:48 -------
Fix:
    Change the compiler option. for example,
    1.	Use -O0
    2.	Do not use -fomit-frame-pointer

-- 
           Summary: ICE on c++ source
           Product: gcc
           Version: 3.4
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: namsh at kldp dot org
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: i686-pc-linux-gnu
  GCC host triplet: i686-pc-linux-gnu
GCC target triplet: m6811-unknown-none


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14629



More information about the Gcc-bugs mailing list