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.
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.
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
Confirmed.
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
Jim -- Was this a regression? If so, would you please also apply the patch to GCC 3.4.1? Thanks, -- Mark
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
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.
Fixed then.