Bug 37769 - [4.3/4.4 Regression] internal compiler error: in reg_overlap_mentioned_for_reload_p, at reload.c:6525
Summary: [4.3/4.4 Regression] internal compiler error: in reg_overlap_mentioned_for_re...
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: rtl-optimization (show other bugs)
Version: 4.3.0
: P4 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords: ice-on-valid-code
Depends on:
Blocks:
 
Reported: 2008-10-08 10:28 UTC by CHIKAMA Masaki
Modified: 2008-11-01 12:45 UTC (History)
2 users (show)

See Also:
Host:
Target: sh4-*-*
Build: sh4-redhat-linux
Known to work: 4.2.4
Known to fail: 4.3.2 4.4.0
Last reconfirmed: 2008-10-09 04:50:48


Attachments
ccXkDOUC.out (72.23 KB, text/plain)
2008-10-08 10:29 UTC, CHIKAMA Masaki
Details
a reduced test case (295 bytes, text/plain)
2008-10-09 04:46 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-08 10:28:08 UTC
gcc-4.3.0 fails to compile with this message when compiling
qtpfsgui-1.9.1.

g++ -c -pipe -funroll-loops -fstrength-reduce -fschedule-insns2 -felide-constructors -frerun-loop-opt -fexceptions -fno-strict-aliasing -fexpensive-optimizations -ffast-math -pipe -O2 -g -mieee -fno-schedule-insns -D_REENTRANT -Wall -W -DQT_NO_DEBUG_OUTPUT -DHAVE_FFTW -DI18NDIR=\"/usr/share/qtpfsgui/i18n\" -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -I/usr/lib/qt4/mkspecs/linux-g++ -I. -I/usr/include/QtCore -I/usr/include/QtCore -I/usr/include/QtGui -I/usr/include/QtGui -I/usr/include -I/usr/include/exiv2 -I/usr/include/OpenEXR -I/usr/include -Igenerated_moc -Igenerated_uic -o generated_obj/pde.o src/TM_operators/fattal02/pde.cpp
src/TM_operators/fattal02/pde.cpp: In function 'void exact_sollution(pfs::Array2D*, pfs::Array2D*)':
src/TM_operators/fattal02/pde.cpp:273: warning: unused variable 'h'
src/TM_operators/fattal02/pde.cpp: In function 'void atimes(long unsigned int, float*, float*, int)':
src/TM_operators/fattal02/pde.cpp:654: internal compiler error: in reg_overlap_mentioned_for_reload_p, at reload.c:6525
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://bugzilla.redhat.com/bugzilla> for instructions.
Preprocessed source stored into /tmp/ccXkDOUC.out file, please attach this to your bugreport.
make: *** [generated_obj/pde.o] Error 1

$ gcc -v
Using built-in specs.
Target: sh4-redhat-linux
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-bootstrap --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-languages=c,c++,objc,obj-c++,java,fortran --enable-java-awt=gtk --disable-dssi --enable-plugin --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-1.5.0.0/jre --enable-libgcj-multifile --enable-java-maintainer-mode --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --disable-libjava-multilib --build=sh4-redhat-linux
Thread model: posix
gcc version 4.3.0 20080428 (Red Hat 4.3.0-8) (GCC)
Comment 1 CHIKAMA Masaki 2008-10-08 10:29:34 UTC
Created attachment 16478 [details]
ccXkDOUC.out
Comment 2 Andrew Pinski 2008-10-08 21:57:02 UTC
You are using an modified compiler from Redhat you should report it to them.
Comment 3 Kazumoto Kojima 2008-10-09 04:46:39 UTC
Created attachment 16480 [details]
a reduced test case

A reduced test case which ICEs with -funroll-loops -ffast-math -O2.
It fails with 4.3/4.4 compilers and doesn't fail with 4.2.
Comment 4 Kazumoto Kojima 2008-10-09 04:50:47 UTC
The regmove pass changes insns in .160r.ce2 dump

(insn 285 77 78 6 foo.C:14 (set (reg/f:SI 260)
        (reg/f:SI 269 [ ivtmp.66 ])) -1 (expr_list:REG_DEAD (reg/f:SI 269 [ ivtmp.66 ])
        (nil)))

(insn 78 285 79 6 foo.C:14 (parallel [
            (set (reg:SF 280)
                (mem:SF (post_inc:SI (reg/f:SI 260)) [2 S4 A32]))
            (use (reg/v:PSI 151 ))
            (clobber (scratch:SI))
        ]) 205 {movsf_ie} (expr_list:REG_INC (reg/f:SI 260)
        (nil)))

to

(insn:HI 285 77 78 6 foo.C:14 (set (reg/f:SI 269 [ ivtmp.66 ])
        (reg/f:SI 269 [ ivtmp.66 ])) -1 (nil))

(insn:HI 78 285 79 6 foo.C:14 (parallel [
            (set (reg:SF 280)
                (mem:SF (post_inc:SI (reg/f:SI 269 [ ivtmp.66 ])) [2 S4 A32]))
            (use (reg/v:PSI 151 ))
            (clobber (scratch:SI))
        ]) 205 {movsf_ie} (expr_list:REG_INC (reg/f:SI 260)
        (nil)))

in .162r.regmove.
It seems that regmove forgets to update the register 260 to 269
in REG_INC note of the insn 78 and this wrong REG_INC note causes
the ICE.
Now I'm testing the attached patch, for 4.3-branch.

BTW, please use the compiler based on the vanilla FSF tree
for bugzilla as Andrew has pointed out already.

--- ORIG/gcc-4_3-branch/gcc/regmove.c	2008-02-20 06:48:51.000000000 +0900
+++ LOCAL/gcc-4_3-branch/gcc/regmove.c	2008-10-09 10:50:29.000000000 +0900
@@ -687,6 +687,12 @@ optimize_reg_copy_2 (rtx insn, rtx dest,
 		if (reg_mentioned_p (dest, PATTERN (q)))
 		  {
 		    PATTERN (q) = replace_rtx (PATTERN (q), dest, src);
+		    if (FIND_REG_INC_NOTE (q, dest))
+		      {
+			remove_note (q, find_reg_note (q, REG_INC, dest));
+			REG_NOTES (q)
+			  = gen_rtx_EXPR_LIST (REG_INC, src, REG_NOTES (q));
+		      }
 		    df_insn_rescan (q);
 		  }
 
Comment 5 Kazumoto Kojima 2008-10-24 23:10:22 UTC
Subject: Bug 37769

Author: kkojima
Date: Fri Oct 24 23:09:00 2008
New Revision: 141354

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=141354
Log:
	PR rtl-optimization/37769
	* regmove.c (optimize_reg_copy_2): Update REG_INC note if needed.


Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/regmove.c

Comment 6 Kazumoto Kojima 2008-11-01 12:40:46 UTC
Subject: Bug 37769

Author: kkojima
Date: Sat Nov  1 12:39:17 2008
New Revision: 141513

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=141513
Log:
	Backport from mainline:
	2008-10-24  Kaz Kojima  <kkojima@gcc.gnu.org>

	PR rtl-optimization/37769
	* regmove.c (optimize_reg_copy_2): Update REG_INC note if needed.


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

Comment 7 Kazumoto Kojima 2008-11-01 12:45:46 UTC
Fixed.