Bug 14093 - [3.4 only] Internal compiler error for code when using -mhitachi option in SH.
[3.4 only] Internal compiler error for code when using -mhitachi option in SH.
Status: RESOLVED FIXED
Product: gcc
Classification: Unclassified
Component: target
3.4.0
: P2 normal
: 3.4.1
Assigned To: Not yet assigned to anyone
: ice-on-valid-code, patch
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2004-02-10 09:49 UTC by Rajesh Shah
Modified: 2004-05-28 23:27 UTC (History)
3 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2004-04-15 12:25:14


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Rajesh Shah 2004-02-10 09:49:59 UTC
Try the code below with sh-coff toolchain

----------------bug.c ---------------------
char foo(void);
void bar()
{
        char gc = foo();
}
----------------bug.c ---------------------

Compile with

sh-coff-gcc -m2 -mhitachi bug.c

It generates following error:

bug.c: In function 'bar':
bug.c:4: internal compiler error: in emit_move_insn, at expr.c:2776
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://gcc.gnu.org/bugs/html> for instructions.
Comment 1 Jim Wilson 2004-04-08 02:00:49 UTC
FUNCTION_VALUE disagrees with TARGET_PROMOTE_FUNCTION_RETURN.  The first says
the result is promoted, the second says the result is not promoted.  This leads
to a emit_move_insn call with different source/dest modes which aborts.
Comment 2 Nitin Yewale 2004-04-15 12:08:54 UTC
Nick has written a patch to solve above bug.

Please find attach patch on below URL.

http://gcc.gnu.org/ml/gcc/2004-04/msg00665.html
Comment 3 Andrew Pinski 2004-04-15 12:25:13 UTC
Confirmed.
Comment 4 CVS Commits 2004-04-30 05:59:14 UTC
Subject: Bug 14093

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	wilson@gcc.gnu.org	2004-04-30 05:59:07

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

Log message:
	Patch from Nick Clifton.
	Bug 14093
	* config/sh/sh-protos.h (sh_promote_prototypes): Declare.
	* config/sh/sh.c (sh_promote_prototypes): Remove declaration.
	Delete static from definition.
	* config/sh/sh.h (FUNCTION_VALUE): Add sh_promote_prototypes call.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&r1=2.3522&r2=2.3523
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/config/sh/sh-protos.h.diff?cvsroot=gcc&r1=1.53&r2=1.54
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/config/sh/sh.c.diff?cvsroot=gcc&r1=1.264&r2=1.265
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/config/sh/sh.h.diff?cvsroot=gcc&r1=1.238&r2=1.239

Comment 5 Mark Mitchell 2004-05-28 22:10:36 UTC
Jim --

Was this a regression?  If so, would you please also apply the patch to GCC 3.4.1?

Thanks,

-- Mark
Comment 6 CVS Commits 2004-05-28 23:06:24 UTC
Subject: Bug 14093

CVSROOT:	/cvs/gcc
Module name:	gcc
Branch: 	gcc-3_4-branch
Changes by:	wilson@gcc.gnu.org	2004-05-28 23:06:11

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

Log message:
	Patch from Nick Clifton.
	Bug 14093
	* config/sh/sh-protos.h (sh_promote_prototypes): Declare.
	* config/sh/sh.c (sh_promote_prototypes): Remove declaration.
	Delete static from definition.
	* config/sh/sh.h (FUNCTION_VALUE): Add sh_promote_prototypes call.

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.453&r2=2.2326.2.454
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/config/sh/sh-protos.h.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.53.4.1&r2=1.53.4.2
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/config/sh/sh.c.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.247.2.6&r2=1.247.2.7
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/config/sh/sh.h.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.230.4.2&r2=1.230.4.3

Comment 7 Jim Wilson 2004-05-28 23:08:17 UTC
Subject: Re:  [3.4 only] Internal compiler error for code
	when using -mhitachi option in SH.

On Fri, 2004-05-28 at 15:10, mmitchel at gcc dot gnu dot org wrote:
> Was this a regression?  If so, would you please also apply the patch to GCC 3.4.1?

3.4 core dumps on the testcase, gcc-3.3 does not.  I added the patch to
the gcc-3.4 branch.
Comment 8 Andrew Pinski 2004-05-28 23:27:14 UTC
Fixed then.