Bug 14457 - [3.4/3.5? Regression] ICE with simple c++ source
Summary: [3.4/3.5? Regression] ICE with simple c++ source
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: target (show other bugs)
Version: 3.4.0
: P2 normal
Target Milestone: 3.4.1
Assignee: Stephane Carrez
URL:
Keywords: ice-on-valid-code
: 14628 (view as bug list)
Depends on:
Blocks:
 
Reported: 2004-03-06 05:26 UTC by namsh
Modified: 2004-10-30 21:11 UTC (History)
3 users (show)

See Also:
Host:
Target: m6811-elf
Build:
Known to work: 3.3.3
Known to fail: 3.4.0 4.0.0
Last reconfirmed: 2004-03-19 06:36:03


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description namsh 2004-03-06 05:26:29 UTC
	3.4.0 20040303 generates ICE. But
	3.4.0 20040227 work fine.

Environment:
System: Linux namsh 2.6.4-rc2 #63 Thu Mar 4 21:18:27 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:
Just do 'm6811-elf-g++ -o tmp.o -c t.cpp -m68hc12'.

The t.ii is:
    # 1 "t.cpp"
    # 1 "<built-in>"
    # 1 "<command line>"
    # 1 "t.cpp"
    class CKMCLink {
    public:
	void LinkDelete(CKMCLink**);
    private:
	CKMCLink *m_prev;
    };

    void
    CKMCLink::LinkDelete(CKMCLink **head)
    {
     if (m_prev == this)
     {
	 *head = 0;
     }
    }
Comment 1 namsh 2004-03-06 05:26:29 UTC
Fix:
    If I do 'm6811-elf-g++ -o tmp.o -c t.cpp -m68hc11'. No ICE.
    If I use m6811-elf-g++ 3.4.0 20040227 with -m68hc12, No ICE.
Comment 2 Andrew Pinski 2004-03-06 05:33:55 UTC
m6811-elf can never be considered critical.
Comment 3 Wolfgang Bangerth 2004-03-06 21:36:16 UTC
Andrew didn't say that, but this must indeed be a target specific thing. It doesn't ICE 
on a compiler targeted for an  x86 linux box. 
 
W. 
Comment 4 namsh 2004-03-19 05:43:21 UTC
I test this with new m6811-elf-gcc 3.4.0 20040318.
And ICE occured. I didn't add ICE message for gcc 20040303.
Here it is generated by gcc 20040318.

$ m6811-elf-g++ -o tmp.o -c t.cpp -m68hc12
t.cpp: In member function `void CKMCLink::LinkDelete(CKMCLink**)':
t.cpp:15: internal compiler error: in change_address_1, at emit-rtl.c:1886
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://gcc.gnu.org/bugs.html> for instructions.

Comment 5 Andrew Pinski 2004-03-19 06:36:00 UTC
Confirmed a regression caused by:
2004-03-07  Stephane Carrez  <stcarrez@nerim.fr>

        * config/m68hc11/m68hc11.md ("*lshrsi3_const"): Disable for 68HC12.
        ("*lshrsi3"): Also accept an immediate for 68HC12.
        ("*ashrsi3_const"): Likewise.
        ("*ashrsi3"): Likewise.
        ("*ashlsi3_const"): Likewise.
        ("*ashlsi3"): Likewise.
        ("cmphi_1_hc12"): Compare two hard register by pushing them and
        comparing with a pop; don't use a split for that.
        ("cmphi split"): Disable compare split for 68HC12.

        * config/m68hc11/m68hc11.c (m68hc11_notice_update_cc): Invalidate
        the status operands if they have side effects.
Comment 6 Andrew Pinski 2004-03-19 06:38:22 UTC
Or this one:
2004-03-06  Stephane Carrez  <stcarrez@nerim.fr>

        * config/m68hc11/m68hc11.c (m68hc11_gen_movhi): Use 2,-sp to push
        the stack register.
        (expand_prologue): Don't make an interrupt or a trap handler a far
        symbol.
        (m68hc11_initial_elimination_offset): Likewise.
Comment 7 Mark Mitchell 2004-06-05 20:27:40 UTC
Stephane --

Are you working on a fix for this problem?

-- Mark
Comment 8 Stephane Carrez 2004-06-06 09:43:32 UTC
Going to work on a fix
Comment 9 Stephane Carrez 2004-06-06 13:24:56 UTC
*** Bug 14628 has been marked as a duplicate of this bug. ***
Comment 10 GCC Commits 2004-06-06 13:50:32 UTC
Subject: Bug 14457

CVSROOT:	/cvs/gcc
Module name:	gcc
Branch: 	gcc-3_4-branch
Changes by:	ciceron@gcc.gnu.org	2004-06-06 13:50:28

Modified files:
	gcc            : ChangeLog 
	gcc/config/m68hc11: m68hc11.c m68hc11-protos.h m68hc11.h 
	                    m68hc11.md 

Log message:
	PR target/14457
	* config/m68hc11/m68hc11.c (splitable_operand): New predicate.
	* config/m68hc11/m68hc11-protos.h (splitable_operand): Declare.
	* config/m68hc11/m68hc11.h (PREDICATE_CODES): Register it.
	(inhibit_libc): Must define.
	* config/m68hc11/m68hc11.md ("movhi_const0"): Use splitable_operand.
	("*andhi3_gen", "iorhi3", "*iorhi3_gen"): Likewise.
	("xorhi3"): Likewise.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=2.2326.2.468&r2=2.2326.2.469
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/config/m68hc11/m68hc11.c.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.91.6.5&r2=1.91.6.6
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/config/m68hc11/m68hc11-protos.h.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.30&r2=1.30.6.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/config/m68hc11/m68hc11.h.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.81.4.1&r2=1.81.4.2
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/config/m68hc11/m68hc11.md.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.54.10.5&r2=1.54.10.6

Comment 11 GCC Commits 2004-06-06 13:56:37 UTC
Subject: Bug 14457

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	ciceron@gcc.gnu.org	2004-06-06 13:56:33

Modified files:
	gcc            : ChangeLog 
	gcc/config/m68hc11: m68hc11.c m68hc11-protos.h m68hc11.h 
	                    m68hc11.md 

Log message:
	PR target/14457
	* config/m68hc11/m68hc11.c (splitable_operand): New predicate.
	* config/m68hc11/m68hc11-protos.h (splitable_operand): Declare.
	* config/m68hc11/m68hc11.h (PREDICATE_CODES): Register it.
	(inhibit_libc): Must define.
	* config/m68hc11/m68hc11.md ("movhi_const0"): Use splitable_operand.
	("*andhi3_gen", "iorhi3", "*iorhi3_gen"): Likewise.
	("xorhi3"): Likewise.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&r1=2.3852&r2=2.3853
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/config/m68hc11/m68hc11.c.diff?cvsroot=gcc&r1=1.103&r2=1.104
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/config/m68hc11/m68hc11-protos.h.diff?cvsroot=gcc&r1=1.31&r2=1.32
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/config/m68hc11/m68hc11.h.diff?cvsroot=gcc&r1=1.86&r2=1.87
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/config/m68hc11/m68hc11.md.diff?cvsroot=gcc&r1=1.64&r2=1.65

Comment 12 Stephane Carrez 2004-06-06 14:01:58 UTC
The bug was caused by a (MEM:HI (MEM:HI reg)) operand that must be split in two
part to access the low and high byte.  Such split is not possible as there is
no (MEM:HI (PLUS:HI (MEM:HI reg) (const_int 1))).  Fixed (see patches).