Bug 37909 - internal compiler error: in fixup_mova, at config/sh/sh.c:3756
Summary: internal compiler error: in fixup_mova, at config/sh/sh.c:3756
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: target (show other bugs)
Version: 4.3.3
: P4 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords: ice-on-valid-code
Depends on:
Blocks:
 
Reported: 2008-10-24 14:03 UTC by CHIKAMA Masaki
Modified: 2008-10-31 13:24 UTC (History)
2 users (show)

See Also:
Host:
Target: sh4-unknown-linux-gnu
Build: i686-pc-linux-gnu
Known to work:
Known to fail: 4.2.4 4.3.3 4.4.0
Last reconfirmed: 2008-10-25 14:48:19


Attachments
ccPOF0j6.out (104.62 KB, text/plain)
2008-10-24 14:04 UTC, CHIKAMA Masaki
Details
a reduced test case (2.10 KB, text/plain)
2008-10-25 14:53 UTC, Kazumoto Kojima
Details

Note You need to log in before you can comment on or make changes to this bug.
Description CHIKAMA Masaki 2008-10-24 14:03:08 UTC
I got internal compile error when compiling vtk.
The flowing ccPOF0j6.cxx is preprocessed file while compiling with sh4 native gcc.
Then I confirm it using gcc-4_3_branch cross compiler.

$ ~/x-tools/sh4-unknown-linux-gnu/bin/sh4-unknown-linux-gnu-gcc -g -O2 -fPIC ccPOF0j6.cxx 
/builddir/build/BUILD/VTK/Rendering/vtkFreeTypeUtilities.cxx: In function 'int vtkFreeTypeUtilitiesRenderString(vtkFreeTypeUtilities*, vtkTextProperty*, const char*, int, int, vtkImageData*, T*, int) [with T = vtkFreeTypeUtilities::RenderString::VTK_TT]':
/builddir/build/BUILD/VTK/Rendering/vtkFreeTypeUtilities.cxx:1190: internal compiler error: in fixup_mova, at config/sh/sh.c:3756
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.

$ ~/x-tools/sh4-unknown-linux-gnu/bin/sh4-unknown-linux-gnu-gcc --version
sh4-unknown-linux-gnu-gcc (crosstool-NG-1.2.0+svn_trunk@1080) 4.3.3 20081022 (prerelease)
Comment 1 CHIKAMA Masaki 2008-10-24 14:04:27 UTC
Created attachment 16537 [details]
ccPOF0j6.out
Comment 2 Kazumoto Kojima 2008-10-25 14:48:19 UTC
I've confirmed that it fails on the trunk and the reduced test
case fails on 4.2.4.
Comment 3 Kazumoto Kojima 2008-10-25 14:53:10 UTC
Created attachment 16540 [details]
a reduced test case

The reduced test case fails on 4.2/4.3.
Comment 4 Kazumoto Kojima 2008-10-26 08:26:21 UTC
sh_reorg might insert a new mova in SH_FIXUP_PCLOAD phase.
When untangle_mova looks this mova insn, it may not be associated
with the insn address yet but the current code takes its undefined
address.  It seems that this mova should be skipped there because
it will be handled later.  I'm testing the attached patch.

--
	* config/sh/sh.c (untangle_mova): Return -1 when NEW_MOVA has
	no address.

--- ORIG/trunk/gcc/config/sh/sh.c	2008-10-22 09:11:15.000000000 +0900
+++ LOCAL/trunk/gcc/config/sh/sh.c	2008-10-26 10:36:59.000000000 +0900
@@ -3826,6 +3826,10 @@ untangle_mova (int *num_mova, rtx *first
 
   if (optimize)
     {
+      /* If NEW_MOVA has no address yet, it will be handled later.  */
+      if (INSN_ADDRESSES_SIZE() <= (unsigned) INSN_UID (new_mova))
+	return -1;
+
       n_addr = INSN_ADDRESSES (INSN_UID (new_mova));
       n_target = INSN_ADDRESSES (INSN_UID (XEXP (MOVA_LABELREF (new_mova), 0)));
       if (n_addr > n_target || n_addr + 1022 < n_target)
Comment 5 Kazumoto Kojima 2008-10-29 23:54:46 UTC
Subject: Bug 37909

Author: kkojima
Date: Wed Oct 29 23:54:35 2008
New Revision: 141452

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=141452
Log:
	PR target/37909
	* config/sh/sh.c (untangle_mova): Return -1 when NEW_MOVA has
	no address.


Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/config/sh/sh.c

Comment 6 Kazumoto Kojima 2008-10-31 03:45:33 UTC
Subject: Bug 37909

Author: kkojima
Date: Fri Oct 31 03:43:20 2008
New Revision: 141486

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=141486
Log:
	PR target/37909
	Backport from mainline:
	* config/sh/sh.c (untangle_mova): Return -1 when NEW_MOVA has
	no address.


Modified:
    branches/gcc-4_3-branch/gcc/ChangeLog
    branches/gcc-4_3-branch/gcc/config/sh/sh.c

Comment 7 Kazumoto Kojima 2008-10-31 03:52:19 UTC
Subject: Bug 37909

Author: kkojima
Date: Fri Oct 31 03:50:02 2008
New Revision: 141487

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=141487
Log:
	PR target/37909
	Backport from mainline:
	* config/sh/sh.c (untangle_mova): Return -1 when NEW_MOVA has
	no address.


Modified:
    branches/gcc-4_2-branch/gcc/ChangeLog
    branches/gcc-4_2-branch/gcc/config/sh/sh.c

Comment 8 Kazumoto Kojima 2008-10-31 13:24:05 UTC
Fixed.