public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
* [Bug rtl-optimization/58369] New: [4.8/4.9 regression] ICE in subreg_get_info when compiling boost for m68k-linux
@ 2013-09-09 11:06 mikpe at it dot uu.se
2013-09-10 8:06 ` [Bug rtl-optimization/58369] " mikpe at it dot uu.se
` (10 more replies)
0 siblings, 11 replies; 12+ messages in thread
From: mikpe at it dot uu.se @ 2013-09-09 11:06 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58369
Bug ID: 58369
Summary: [4.8/4.9 regression] ICE in subreg_get_info when
compiling boost for m68k-linux
Product: gcc
Version: 4.8.2
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: rtl-optimization
Assignee: unassigned at gcc dot gnu.org
Reporter: mikpe at it dot uu.se
Created attachment 30773
--> http://gcc.gnu.org/bugzilla/attachment.cgi?id=30773&action=edit
Pre-processed non-reduced test case
Attempting to compile boost-1.54 with g++ 4.8 or 4.9 for m68k-linux (after
fixing a known boost alignment error that breaks jam) causes an ICE:
> g++ -O2 -fPIC -S ellint_3f.ii
In file included from ./boost/math/special_functions/ellint_3.hpp:22:0,
from ./boost/math/special_functions.hpp:27,
from libs/math/src/tr1/pch.hpp:9,
from libs/math/build/../src/tr1/ellint_3f.cpp:6:
./boost/math/special_functions/ellint_rj.hpp: In function 'T
boost::math::detail::ellint_rj_imp(T, T, T, T, const Policy&) [with T = double;
Policy =
boost::math::policies::policy<boost::math::policies::domain_error<(boost::math::policies::error_policy_type)1u>,
boost::math::policies::pole_error<(boost::math::policies::error_policy_type)1u>,
boost::math::policies::overflow_error<(boost::math::policies::error_policy_type)1u>,
boost::math::policies::evaluation_error<(boost::math::policies::error_policy_type)1u>,
boost::math::policies::rounding_error<(boost::math::policies::error_policy_type)1u>,
boost::math::policies::default_policy, boost::math::policies::default_policy,
boost::math::policies::default_policy, boost::math::policies::default_policy,
boost::math::policies::default_policy,
boost::math::policies::default_policy>]':
./boost/math/special_functions/ellint_rj.hpp:151:1: internal compiler error: in
subreg_get_info, at rtlanal.c:3394
0x76ca1c subreg_get_info(unsigned int, machine_mode, unsigned int,
machine_mode, subreg_info*)
/tmp/gcc-4.8-r193425/gcc/rtlanal.c:3394
0x76ca2b subreg_regno_offset(unsigned int, machine_mode, unsigned int,
machine_mode)
/tmp/gcc-4.8-r193425/gcc/rtlanal.c:3446
0x75d1f0 choose_reload_regs
/tmp/gcc-4.8-r193425/gcc/reload1.c:6564
0x761227 reload_as_needed
/tmp/gcc-4.8-r193425/gcc/reload1.c:4648
0x766f5e reload(rtx_def*, int)
/tmp/gcc-4.8-r193425/gcc/reload1.c:1055
0x6ab68b do_reload
/tmp/gcc-4.8-r193425/gcc/ira.c:4636
0x6ab68b rest_of_handle_reload
/tmp/gcc-4.8-r193425/gcc/ira.c:4737
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <http://gcc.gnu.org/bugs.html> for instructions.
4.7 is Ok. Started with Bin Cheng's r193425. Reproducible with a cross.
Originally from <http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=719484>.
Currently attempting to auto-reduce the test case, but it's a painfully slow
process.
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug rtl-optimization/58369] [4.8/4.9 regression] ICE in subreg_get_info when compiling boost for m68k-linux 2013-09-09 11:06 [Bug rtl-optimization/58369] New: [4.8/4.9 regression] ICE in subreg_get_info when compiling boost for m68k-linux mikpe at it dot uu.se @ 2013-09-10 8:06 ` mikpe at it dot uu.se 2013-09-10 12:48 ` mikpe at it dot uu.se ` (9 subsequent siblings) 10 siblings, 0 replies; 12+ messages in thread From: mikpe at it dot uu.se @ 2013-09-10 8:06 UTC (permalink / raw) To: gcc-bugs http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58369 --- Comment #1 from Mikael Pettersson <mikpe at it dot uu.se> --- Created attachment 30783 --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=30783&action=edit smaller test case, from C-reduce ^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug rtl-optimization/58369] [4.8/4.9 regression] ICE in subreg_get_info when compiling boost for m68k-linux 2013-09-09 11:06 [Bug rtl-optimization/58369] New: [4.8/4.9 regression] ICE in subreg_get_info when compiling boost for m68k-linux mikpe at it dot uu.se 2013-09-10 8:06 ` [Bug rtl-optimization/58369] " mikpe at it dot uu.se @ 2013-09-10 12:48 ` mikpe at it dot uu.se 2013-09-10 16:49 ` mikpe at it dot uu.se ` (8 subsequent siblings) 10 siblings, 0 replies; 12+ messages in thread From: mikpe at it dot uu.se @ 2013-09-10 12:48 UTC (permalink / raw) To: gcc-bugs http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58369 --- Comment #2 from Mikael Pettersson <mikpe at it dot uu.se> --- Created attachment 30787 --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=30787&action=edit hand-reduced test case This is as small as I can get it without losing the ICE. ^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug rtl-optimization/58369] [4.8/4.9 regression] ICE in subreg_get_info when compiling boost for m68k-linux 2013-09-09 11:06 [Bug rtl-optimization/58369] New: [4.8/4.9 regression] ICE in subreg_get_info when compiling boost for m68k-linux mikpe at it dot uu.se 2013-09-10 8:06 ` [Bug rtl-optimization/58369] " mikpe at it dot uu.se 2013-09-10 12:48 ` mikpe at it dot uu.se @ 2013-09-10 16:49 ` mikpe at it dot uu.se 2013-09-11 19:10 ` mikpe at it dot uu.se ` (7 subsequent siblings) 10 siblings, 0 replies; 12+ messages in thread From: mikpe at it dot uu.se @ 2013-09-10 16:49 UTC (permalink / raw) To: gcc-bugs http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58369 --- Comment #3 from Mikael Pettersson <mikpe at it dot uu.se> --- The ICE occurs because reload is asking for a DFmode (8-byte) subreg of an XFmode (12-byte) hardreg, but 12 % 8 != 0 so the gcc_assert fails. ^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug rtl-optimization/58369] [4.8/4.9 regression] ICE in subreg_get_info when compiling boost for m68k-linux 2013-09-09 11:06 [Bug rtl-optimization/58369] New: [4.8/4.9 regression] ICE in subreg_get_info when compiling boost for m68k-linux mikpe at it dot uu.se ` (2 preceding siblings ...) 2013-09-10 16:49 ` mikpe at it dot uu.se @ 2013-09-11 19:10 ` mikpe at it dot uu.se 2013-10-30 19:21 ` law at gcc dot gnu.org ` (6 subsequent siblings) 10 siblings, 0 replies; 12+ messages in thread From: mikpe at it dot uu.se @ 2013-09-11 19:10 UTC (permalink / raw) To: gcc-bugs http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58369 --- Comment #4 from Mikael Pettersson <mikpe at it dot uu.se> --- (All source references here are for vanilla gcc-4.8.1.) The problem appears to start in choose_reload_regs, in the "if (inheritance)" block at lines 6497 to 6679. It finds (reg:DF 0 %d0 [orig:109 D.2384 ] [109]) in rld[r].in. The "if (regno >= 0 ...)" test at line 6543 passes so that block is entered. last_reg is (reg:XF 17 %fp1) and byte is still 0, so it calls subreg_regno_offset (17, XFmode, 0, DFmode) at line 6560. subreg_regno_offset in turn just calls subreg_get_info. In subreg_get_info xmode is XFmode with size 12 and precision 80, while ymode is DFmode with size 8 and precision 64. The first "if (HARD_REGNO_NREGS_HAS_PADDING ...)" is false so that block is skipped. nregs_xmode and nregs_ymode are computed, both are 1. The second if for paradoxical subregs is false, so that block is skipped. The third if "If registers store different numbers of bits in the different modes, we cannot generally form this subreg" at line 3345 is true, so that block is entered. regsize_xmode and regsize_ymode are computed, they are 12 and 8 respectively. None of the inner if:s there are true, because nregs_xmode and nregs_ymode are both 1, which isn't > 1, so we don't return. The fourth if for lowpart subregs at line 3371 is false, because the input offset is 0 ("byte" from choose_reload_regs), but subreg_lowpart_offset (DFmode, XFmode) returns 4, and 0 != 4. So that block is skipped. Next we reach the "gcc_assert ((GET_MODE_SIZE (xmode) % GET_MODE_SIZE (ymode)) == 0);" at line 3387. However, this evaluates as (12 % 8) == 0, which is false, so the assertion fails and we ICE. So the problem as I understand it is that choose_reload_regs forms a virtual subreg with differently-sized modes and offset 0, while on big-endian machines the offset must be >0 (see subreg_lowpart_offset in emit-rtl.c), so the virtual subreg is not recognized as a normal lowpart subreg. I *think* other machines don't see this problem because: a) offset 0 is correct for little-endian like x86 and most ARMs, b) many big-endian machines define CANNOT_CHANGE_MODE_CLASS to reject differently-sized modes in floating-point registers, which can prevent the bogus subreg_regno_offset call, c) their larger modes are whole multiples of their smaller modes, so the assertion doesn't fail. However, m68k: d) is big-endian, e) doesn't define CANNOT_CHANGE_MODE_CLASS, f) has an XFmode which is 1.5 times as large as its DFmode. If I add a suitable definition of CANNOT_CHANGE_MODE_CLASS, e.g. --- gcc-4.8.1/gcc/config/m68k/m68k.h.~1~ 2013-01-10 21:38:27.000000000 +0100 +++ gcc-4.8.1/gcc/config/m68k/m68k.h 2013-09-11 18:28:58.160242077 +0200 @@ -409,6 +409,11 @@ along with GCC; see the file COPYING3. #define HARD_REGNO_MODE_OK(REGNO, MODE) \ m68k_regno_mode_ok ((REGNO), (MODE)) +#define CANNOT_CHANGE_MODE_CLASS(FROM, TO, CLASS) \ + (GET_MODE_SIZE (FROM) != GET_MODE_SIZE (TO) \ + ? reg_classes_intersect_p (FP_REGS, CLASS) \ + : 0) + #define SECONDARY_RELOAD_CLASS(CLASS, MODE, X) \ m68k_secondary_reload_class (CLASS, MODE, X) then the ICE disappears. However, reading the m68k backend I think this is against its intentions, and I suspect it is stricter than necessary. Other calls to subreg_regno_offset either take the parameters from an existing real subreg, or compute a correct lowpart offset (regcprop.c:maybe_mode_change, var-tracking.c:var_lowpart). So I'm starting to think that the bug is in choose_reload_regs: it should pass a proper lowpart offset in byte, not the constant 0 (byte is only set for input subregs that are pseudos). The following patch: --- gcc-4.8.1/gcc/reload1.c.~1~ 2013-01-21 15:55:05.000000000 +0100 +++ gcc-4.8.1/gcc/reload1.c 2013-09-11 19:58:37.979482251 +0200 @@ -6497,6 +6497,7 @@ choose_reload_regs (struct insn_chain *c if (inheritance) { int byte = 0; + bool byte_is_fixed = false; int regno = -1; enum machine_mode mode = VOIDmode; @@ -6519,7 +6520,10 @@ choose_reload_regs (struct insn_chain *c if (regno < FIRST_PSEUDO_REGISTER) regno = subreg_regno (rld[r].in_reg); else - byte = SUBREG_BYTE (rld[r].in_reg); + { + byte = SUBREG_BYTE (rld[r].in_reg); + byte_is_fixed = true; + } mode = GET_MODE (rld[r].in_reg); } #ifdef AUTO_INC_DEC @@ -6557,6 +6561,8 @@ choose_reload_regs (struct insn_chain *c rtx last_reg = reg_last_reload_reg[regno]; i = REGNO (last_reg); + if (! byte_is_fixed) + byte = subreg_lowpart_offset (mode, GET_MODE (last_reg)); i += subreg_regno_offset (i, GET_MODE (last_reg), byte, mode); last_class = REGNO_REG_CLASS (i); also fixes the ICE, and seems more correct to me. I'll do full bootstraps and regression test runs with it on my usual targets (x86_64, arm, m68k, sparc64, powerpc64) shortly. ^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug rtl-optimization/58369] [4.8/4.9 regression] ICE in subreg_get_info when compiling boost for m68k-linux 2013-09-09 11:06 [Bug rtl-optimization/58369] New: [4.8/4.9 regression] ICE in subreg_get_info when compiling boost for m68k-linux mikpe at it dot uu.se ` (3 preceding siblings ...) 2013-09-11 19:10 ` mikpe at it dot uu.se @ 2013-10-30 19:21 ` law at gcc dot gnu.org 2013-10-30 20:51 ` [Bug rtl-optimization/58369] [4.8 " mikpelinux at gmail dot com ` (5 subsequent siblings) 10 siblings, 0 replies; 12+ messages in thread From: law at gcc dot gnu.org @ 2013-10-30 19:21 UTC (permalink / raw) To: gcc-bugs http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58369 --- Comment #5 from Jeffrey A. Law <law at gcc dot gnu.org> --- Author: law Date: Wed Oct 30 19:21:27 2013 New Revision: 204224 URL: http://gcc.gnu.org/viewcvs?rev=204224&root=gcc&view=rev Log: PR rtl-optimization/58369 * reload1.c (compute_reload_subreg_offset): New function. (choose_reload_regs): Use it to pass endian-correct offset to subreg_regno_offset. * PR rtl-optimization/58369 * g++.dg/torture/pr58369.C: New test. Added: trunk/gcc/testsuite/g++.dg/torture/pr58369.C Modified: trunk/gcc/ChangeLog trunk/gcc/reload1.c trunk/gcc/testsuite/ChangeLog ^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug rtl-optimization/58369] [4.8 regression] ICE in subreg_get_info when compiling boost for m68k-linux 2013-09-09 11:06 [Bug rtl-optimization/58369] New: [4.8/4.9 regression] ICE in subreg_get_info when compiling boost for m68k-linux mikpe at it dot uu.se ` (4 preceding siblings ...) 2013-10-30 19:21 ` law at gcc dot gnu.org @ 2013-10-30 20:51 ` mikpelinux at gmail dot com 2013-11-19 9:51 ` rguenth at gcc dot gnu.org ` (4 subsequent siblings) 10 siblings, 0 replies; 12+ messages in thread From: mikpelinux at gmail dot com @ 2013-10-30 20:51 UTC (permalink / raw) To: gcc-bugs http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58369 Mikael Pettersson <mikpelinux at gmail dot com> changed: What |Removed |Added ---------------------------------------------------------------------------- Known to work| |4.9.0 Summary|[4.8/4.9 regression] ICE in |[4.8 regression] ICE in |subreg_get_info when |subreg_get_info when |compiling boost for |compiling boost for |m68k-linux |m68k-linux Known to fail|4.9.0 |4.8.2 --- Comment #6 from Mikael Pettersson <mikpelinux at gmail dot com> --- Fixed on trunk so far. ^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug rtl-optimization/58369] [4.8 regression] ICE in subreg_get_info when compiling boost for m68k-linux 2013-09-09 11:06 [Bug rtl-optimization/58369] New: [4.8/4.9 regression] ICE in subreg_get_info when compiling boost for m68k-linux mikpe at it dot uu.se ` (5 preceding siblings ...) 2013-10-30 20:51 ` [Bug rtl-optimization/58369] [4.8 " mikpelinux at gmail dot com @ 2013-11-19 9:51 ` rguenth at gcc dot gnu.org 2014-05-22 9:04 ` rguenth at gcc dot gnu.org ` (3 subsequent siblings) 10 siblings, 0 replies; 12+ messages in thread From: rguenth at gcc dot gnu.org @ 2013-11-19 9:51 UTC (permalink / raw) To: gcc-bugs http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58369 Richard Biener <rguenth at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Target Milestone|--- |4.8.3 ^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug rtl-optimization/58369] [4.8 regression] ICE in subreg_get_info when compiling boost for m68k-linux 2013-09-09 11:06 [Bug rtl-optimization/58369] New: [4.8/4.9 regression] ICE in subreg_get_info when compiling boost for m68k-linux mikpe at it dot uu.se ` (6 preceding siblings ...) 2013-11-19 9:51 ` rguenth at gcc dot gnu.org @ 2014-05-22 9:04 ` rguenth at gcc dot gnu.org 2014-12-10 12:46 ` rguenth at gcc dot gnu.org ` (2 subsequent siblings) 10 siblings, 0 replies; 12+ messages in thread From: rguenth at gcc dot gnu.org @ 2014-05-22 9:04 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=58369 Richard Biener <rguenth at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Target Milestone|4.8.3 |4.8.4 --- Comment #7 from Richard Biener <rguenth at gcc dot gnu.org> --- GCC 4.8.3 is being released, adjusting target milestone. ^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug rtl-optimization/58369] [4.8 regression] ICE in subreg_get_info when compiling boost for m68k-linux 2013-09-09 11:06 [Bug rtl-optimization/58369] New: [4.8/4.9 regression] ICE in subreg_get_info when compiling boost for m68k-linux mikpe at it dot uu.se ` (7 preceding siblings ...) 2014-05-22 9:04 ` rguenth at gcc dot gnu.org @ 2014-12-10 12:46 ` rguenth at gcc dot gnu.org 2014-12-19 13:36 ` jakub at gcc dot gnu.org 2015-01-19 22:32 ` law at redhat dot com 10 siblings, 0 replies; 12+ messages in thread From: rguenth at gcc dot gnu.org @ 2014-12-10 12:46 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=58369 Richard Biener <rguenth at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Priority|P3 |P2 ^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug rtl-optimization/58369] [4.8 regression] ICE in subreg_get_info when compiling boost for m68k-linux 2013-09-09 11:06 [Bug rtl-optimization/58369] New: [4.8/4.9 regression] ICE in subreg_get_info when compiling boost for m68k-linux mikpe at it dot uu.se ` (8 preceding siblings ...) 2014-12-10 12:46 ` rguenth at gcc dot gnu.org @ 2014-12-19 13:36 ` jakub at gcc dot gnu.org 2015-01-19 22:32 ` law at redhat dot com 10 siblings, 0 replies; 12+ messages in thread From: jakub at gcc dot gnu.org @ 2014-12-19 13:36 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=58369 Jakub Jelinek <jakub at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Target Milestone|4.8.4 |4.8.5 --- Comment #8 from Jakub Jelinek <jakub at gcc dot gnu.org> --- GCC 4.8.4 has been released. ^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug rtl-optimization/58369] [4.8 regression] ICE in subreg_get_info when compiling boost for m68k-linux 2013-09-09 11:06 [Bug rtl-optimization/58369] New: [4.8/4.9 regression] ICE in subreg_get_info when compiling boost for m68k-linux mikpe at it dot uu.se ` (9 preceding siblings ...) 2014-12-19 13:36 ` jakub at gcc dot gnu.org @ 2015-01-19 22:32 ` law at redhat dot com 10 siblings, 0 replies; 12+ messages in thread From: law at redhat dot com @ 2015-01-19 22:32 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=58369 Jeffrey A. Law <law at redhat dot com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |RESOLVED CC| |law at redhat dot com Resolution|--- |FIXED --- Comment #9 from Jeffrey A. Law <law at redhat dot com> --- Resolved on 4.9/trunk, not planning to backport to 4.8. ^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2015-01-19 22:32 UTC | newest] Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2013-09-09 11:06 [Bug rtl-optimization/58369] New: [4.8/4.9 regression] ICE in subreg_get_info when compiling boost for m68k-linux mikpe at it dot uu.se 2013-09-10 8:06 ` [Bug rtl-optimization/58369] " mikpe at it dot uu.se 2013-09-10 12:48 ` mikpe at it dot uu.se 2013-09-10 16:49 ` mikpe at it dot uu.se 2013-09-11 19:10 ` mikpe at it dot uu.se 2013-10-30 19:21 ` law at gcc dot gnu.org 2013-10-30 20:51 ` [Bug rtl-optimization/58369] [4.8 " mikpelinux at gmail dot com 2013-11-19 9:51 ` rguenth at gcc dot gnu.org 2014-05-22 9:04 ` rguenth at gcc dot gnu.org 2014-12-10 12:46 ` rguenth at gcc dot gnu.org 2014-12-19 13:36 ` jakub at gcc dot gnu.org 2015-01-19 22:32 ` law at redhat dot com
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).