public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/29599]  New: [4.1/4.2 Regression] ICE when building the kernel on SH4
@ 2006-10-26  7:41 vapier at gentoo dot org
  2006-10-26  7:44 ` [Bug target/29599] " vapier at gentoo dot org
                   ` (10 more replies)
  0 siblings, 11 replies; 12+ messages in thread
From: vapier at gentoo dot org @ 2006-10-26  7:41 UTC (permalink / raw)
  To: gcc-bugs

when cross-compiling the kernel for SH4 with gcc-4.1.1, we hit an ICE:

  CC      drivers/mmc/mmc_block.o
/mnt/data/_home/mano/linuxsh/kernel/linux-2.6.19-rc2-work/drivers/mmc/mmc_block.c:
In function 'mmc_blk_issue_rq':
/mnt/data/_home/mano/linuxsh/kernel/linux-2.6.19-rc2-work/drivers/mmc/mmc_block.c:395:
error: unrecognizable insn:
(insn 1116 732 738 31 (set (reg:SI 1 r1 [576])
        (const_int 2147483972 [0x80000144])) -1 (nil)
    (nil))
/mnt/data/_home/mano/linuxsh/kernel/linux-2.6.19-rc2-work/drivers/mmc/mmc_block.c:395:
internal compiler error: in extract_insn, at recog.c:2084
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://bugs.gentoo.org/> for instructions.

checked on a Gentoo ppc/x86_64 host for the sh4 target with gcc-3.4.6 and
gcc-4.1.1 and gcc-4.2.0-20061014


-- 
           Summary: [4.1/4.2 Regression] ICE when building the kernel on SH4
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: vapier at gentoo dot org
  GCC host triplet: x86_64-linux
GCC target triplet: sh4-linux


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29599


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug target/29599] [4.1/4.2 Regression] ICE when building the kernel on SH4
  2006-10-26  7:41 [Bug target/29599] New: [4.1/4.2 Regression] ICE when building the kernel on SH4 vapier at gentoo dot org
@ 2006-10-26  7:44 ` vapier at gentoo dot org
  2006-10-29 16:47 ` [Bug target/29599] [4.1/4.2/4.3 " pinskia at gcc dot gnu dot org
                   ` (9 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: vapier at gentoo dot org @ 2006-10-26  7:44 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from vapier at gentoo dot org  2006-10-26 07:44 -------
Created an attachment (id=12496)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=12496&action=view)
PR29599-ice.i

reduced test case:

$ sh4-unknown-linux-gnu-gcc-4.1.1 -c -O2 PR29599-ice.i
PR29599-ice.i: In function 'mmc_blk_issue_rq':
PR29599-ice.i:15: error: unrecognizable insn:
(insn 70 65 35 1 (set (reg/f:SI 1 r1 [orig:159 buf.0 ] [159])
        (const_int 2147483656 [0x80000008])) -1 (nil)
    (nil))
PR29599-ice.i:15: internal compiler error: in extract_insn, at recog.c:2084

$ sh4-unknown-linux-gnu-gcc-4.2.0-alpha20061014 -c -O2 PR29599-ice.i
PR29599-ice.i: In function 'mmc_blk_issue_rq':
PR29599-ice.i:15: error: unrecognizable insn:
(insn 68 25 28 3 (set (reg:SI 2 r2 [166])
        (const_int 2147483656 [0x80000008])) -1 (nil)
    (nil))
PR29599-ice.i:15: internal compiler error: in extract_insn, at recog.c:2077


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29599


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug target/29599] [4.1/4.2/4.3 Regression] ICE when building the kernel on SH4
  2006-10-26  7:41 [Bug target/29599] New: [4.1/4.2 Regression] ICE when building the kernel on SH4 vapier at gentoo dot org
  2006-10-26  7:44 ` [Bug target/29599] " vapier at gentoo dot org
@ 2006-10-29 16:47 ` pinskia at gcc dot gnu dot org
  2006-11-13  3:23 ` mmitchel at gcc dot gnu dot org
                   ` (8 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-10-29 16:47 UTC (permalink / raw)
  To: gcc-bugs



-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|[4.1/4.2 Regression] ICE    |[4.1/4.2/4.3 Regression] ICE
                   |when building the kernel on |when building the kernel on
                   |SH4                         |SH4
   Target Milestone|---                         |4.1.2


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29599


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug target/29599] [4.1/4.2/4.3 Regression] ICE when building the kernel on SH4
  2006-10-26  7:41 [Bug target/29599] New: [4.1/4.2 Regression] ICE when building the kernel on SH4 vapier at gentoo dot org
  2006-10-26  7:44 ` [Bug target/29599] " vapier at gentoo dot org
  2006-10-29 16:47 ` [Bug target/29599] [4.1/4.2/4.3 " pinskia at gcc dot gnu dot org
@ 2006-11-13  3:23 ` mmitchel at gcc dot gnu dot org
  2006-12-06  0:40 ` kkojima at gcc dot gnu dot org
                   ` (7 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2006-11-13  3:23 UTC (permalink / raw)
  To: gcc-bugs



-- 

mmitchel at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P5


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29599


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug target/29599] [4.1/4.2/4.3 Regression] ICE when building the kernel on SH4
  2006-10-26  7:41 [Bug target/29599] New: [4.1/4.2 Regression] ICE when building the kernel on SH4 vapier at gentoo dot org
                   ` (2 preceding siblings ...)
  2006-11-13  3:23 ` mmitchel at gcc dot gnu dot org
@ 2006-12-06  0:40 ` kkojima at gcc dot gnu dot org
  2007-02-07 21:40 ` patchapp at dberlin dot org
                   ` (6 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: kkojima at gcc dot gnu dot org @ 2006-12-06  0:40 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from kkojima at gcc dot gnu dot org  2006-12-06 00:40 -------
I've looked at what is going on.  The variable "block" is
placed at sfp - 4 where sfp is the software frame pointer.
Then the expression (unsigned long) buf - 0x80000000 is
sfp - 0x80000000 - 4.  The cse pass folds the constant
part of this expression with simplify_const_binary_operation.
As simplify_const_binary_operation computes it as 64-bit
HOST_WIDE_INT constant and returns
gen_int_mode (- 0x80000000 - 4, SImode).
Since gen_int_mode ( , SImode) truncates the constant to 32-bit,
it returns (const_int 2147483644 [0x7ffffffc]).
Thus cse makes a REG_EQUAL note below:

(insn 30 29 32 3 (set (reg:SI 168)
        (plus:SI (reg/f:SI 159 [ buf.1 ])
            (reg:SI 167))) 35 {*addsi3_compact} (nil)
    (expr_list:REG_EQUAL (plus:SI (reg/f:SI 153 sfp)
            (const_int 2147483644 [0x7ffffffc]))
        (nil)))

When reloading, eliminate_regs_in_insn tries to replace sfp
with sp + 12 where sp is the hard stack pointer register
and changes the above insn 30 to the insns

(set (hard-reg:SI) (const_int 0x7ffffffc + 12))
(set (hard-reg':SI) (plus:SI (hard-reg:SI) (reg:SI sp)))

Since eliminate_regs_in_insn computes the constant offset
as HOST_WIDE_INT with ignoring the mode of destination,
the first insn of the insns is

(set (hard-reg:SI) (const_int 0x80000008))

However, movsi_ie which is the constant load pattern of SH
checks it source with general_movsrc_operand which is
essentially general_operand predicate and 0x80000008 is
out of range as a SImode constant.  Thus the above set insn
fails to be recognised.

I thought that if eliminate_regs_in_insn took account of
the mode of the destination, then it'll generate
(set (hard-reg:SI) (const_int 0xffffffff80000008)) instead
of the above set insn.

--- ORIG/trunk/gcc/reload1.c    2006-11-19 10:41:46.000000000 +0900
+++ LOCAL/trunk/gcc/reload1.c   2006-12-04 08:29:43.000000000 +0900
@@ -3093,7 +3093,15 @@ eliminate_regs_in_insn (rtx insn, int re
        if (ep->from_rtx == reg && ep->can_eliminate)
          {
            rtx to_rtx = ep->to_rtx;
+           unsigned int width = GET_MODE_BITSIZE (GET_MODE (reg));
+
            offset += ep->offset;
+           if (width < HOST_BITS_PER_WIDE_INT)
+             {
+               offset &= ((HOST_WIDE_INT) 1 << width) - 1;
+               if (offset &  ((HOST_WIDE_INT) 1 << (width - 1)))
+                 offset |= ((HOST_WIDE_INT) (-1) << width);
+             }

            if (GET_CODE (XEXP (plus_cst_src, 0)) == SUBREG)
              to_rtx = gen_lowpart (GET_MODE (XEXP (plus_cst_src, 0)),

I'm not sure that this is in the right direction, and it
seems to be too invasive anyway.

SH target modifies the operands of move insns in
prepare_move_operands if needed.  I guess the it'd be
appropriate to handle this issue.  Here is a patch in
testing now:

--- ORIG/trunk/gcc/config/sh/sh.c       2006-12-03 10:58:32.000000000 +0900
+++ LOCAL/trunk/gcc/config/sh/sh.c      2006-12-04 22:57:42.000000000 +0900
@@ -1345,6 +1345,20 @@ prepare_move_operands (rtx operands[], e
        }
     }

+  /* Reload might make move insn from const_int to a register of
+     which mode is narrower than HOST_WIDE_INT where the value of
+     const_int is out of range for that mode.  See PR 29599.  */
+  if (GET_MODE_BITSIZE (mode) < HOST_BITS_PER_WIDE_INT
+      && GET_CODE (operands[1]) == CONST_INT)
+    {
+      unsigned int width = GET_MODE_BITSIZE (mode);
+      HOST_WIDE_INT val = INTVAL (operands[1]);
+
+      val &= ((HOST_WIDE_INT) 1 << width) - 1;
+      if (val & ((HOST_WIDE_INT) 1 << (width - 1)))
+       operands[1] = GEN_INT (((HOST_WIDE_INT) (-1) << width) | val);
+    }
+
   return 0;
 }



-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29599


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug target/29599] [4.1/4.2/4.3 Regression] ICE when building the kernel on SH4
  2006-10-26  7:41 [Bug target/29599] New: [4.1/4.2 Regression] ICE when building the kernel on SH4 vapier at gentoo dot org
                   ` (3 preceding siblings ...)
  2006-12-06  0:40 ` kkojima at gcc dot gnu dot org
@ 2007-02-07 21:40 ` patchapp at dberlin dot org
  2007-02-08 23:55 ` [Bug rtl-optimization/29599] " kkojima at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: patchapp at dberlin dot org @ 2007-02-07 21:40 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from patchapp at dberlin dot org  2007-02-07 21:40 -------
Subject: Bug number PR target/29599

A patch for this bug has been added to the patch tracker.
The mailing list url for the patch is
http://gcc.gnu.org/ml/gcc-patches/2007-02/msg00646.html


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29599


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug rtl-optimization/29599] [4.1/4.2/4.3 Regression] ICE when building the kernel on SH4
  2006-10-26  7:41 [Bug target/29599] New: [4.1/4.2 Regression] ICE when building the kernel on SH4 vapier at gentoo dot org
                   ` (4 preceding siblings ...)
  2007-02-07 21:40 ` patchapp at dberlin dot org
@ 2007-02-08 23:55 ` kkojima at gcc dot gnu dot org
  2007-02-10  6:48 ` kkojima at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: kkojima at gcc dot gnu dot org @ 2007-02-08 23:55 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from kkojima at gcc dot gnu dot org  2007-02-08 23:54 -------
Alex suggested that it's a problem in the generic part of the compiler.
I'm preparing another patch according to his suggestion.


-- 

kkojima at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|target                      |rtl-optimization


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29599


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug rtl-optimization/29599] [4.1/4.2/4.3 Regression] ICE when building the kernel on SH4
  2006-10-26  7:41 [Bug target/29599] New: [4.1/4.2 Regression] ICE when building the kernel on SH4 vapier at gentoo dot org
                   ` (5 preceding siblings ...)
  2007-02-08 23:55 ` [Bug rtl-optimization/29599] " kkojima at gcc dot gnu dot org
@ 2007-02-10  6:48 ` kkojima at gcc dot gnu dot org
  2007-02-14  9:40 ` mmitchel at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: kkojima at gcc dot gnu dot org @ 2007-02-10  6:48 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from kkojima at gcc dot gnu dot org  2007-02-10 06:48 -------
Subject: Bug 29599

Author: kkojima
Date: Sat Feb 10 06:47:49 2007
New Revision: 121792

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=121792
Log:
        PR rtl-optimization/29599
        * reload1.c (eliminate_regs_in_insn): Take the destination
        mode into account when computing the offset.


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


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29599


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug rtl-optimization/29599] [4.1/4.2/4.3 Regression] ICE when building the kernel on SH4
  2006-10-26  7:41 [Bug target/29599] New: [4.1/4.2 Regression] ICE when building the kernel on SH4 vapier at gentoo dot org
                   ` (6 preceding siblings ...)
  2007-02-10  6:48 ` kkojima at gcc dot gnu dot org
@ 2007-02-14  9:40 ` mmitchel at gcc dot gnu dot org
  2007-02-15  7:26 ` kkojima at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2007-02-14  9:40 UTC (permalink / raw)
  To: gcc-bugs



-- 

mmitchel at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|4.1.2                       |4.1.3


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29599


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug rtl-optimization/29599] [4.1/4.2/4.3 Regression] ICE when building the kernel on SH4
  2006-10-26  7:41 [Bug target/29599] New: [4.1/4.2 Regression] ICE when building the kernel on SH4 vapier at gentoo dot org
                   ` (7 preceding siblings ...)
  2007-02-14  9:40 ` mmitchel at gcc dot gnu dot org
@ 2007-02-15  7:26 ` kkojima at gcc dot gnu dot org
  2007-02-18 23:08 ` kkojima at gcc dot gnu dot org
  2007-02-18 23:10 ` kkojima at gcc dot gnu dot org
  10 siblings, 0 replies; 12+ messages in thread
From: kkojima at gcc dot gnu dot org @ 2007-02-15  7:26 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from kkojima at gcc dot gnu dot org  2007-02-15 07:26 -------
Subject: Bug 29599

Author: kkojima
Date: Thu Feb 15 07:26:30 2007
New Revision: 121985

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=121985
Log:
        PR rtl-optimization/29599
        Backport from mainline.
        * reload1.c (eliminate_regs_in_insn): Take the destination
        mode into account when computing the offset.


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


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29599


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug rtl-optimization/29599] [4.1/4.2/4.3 Regression] ICE when building the kernel on SH4
  2006-10-26  7:41 [Bug target/29599] New: [4.1/4.2 Regression] ICE when building the kernel on SH4 vapier at gentoo dot org
                   ` (8 preceding siblings ...)
  2007-02-15  7:26 ` kkojima at gcc dot gnu dot org
@ 2007-02-18 23:08 ` kkojima at gcc dot gnu dot org
  2007-02-18 23:10 ` kkojima at gcc dot gnu dot org
  10 siblings, 0 replies; 12+ messages in thread
From: kkojima at gcc dot gnu dot org @ 2007-02-18 23:08 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from kkojima at gcc dot gnu dot org  2007-02-18 23:08 -------
Subject: Bug 29599

Author: kkojima
Date: Sun Feb 18 23:08:15 2007
New Revision: 122109

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=122109
Log:
        Backport from mainline.
        PR rtl-optimization/29599
        * reload1.c (eliminate_regs_in_insn): Take the destination
        mode into account when computing the offset.


Modified:
    branches/gcc-4_1-branch/gcc/ChangeLog
    branches/gcc-4_1-branch/gcc/reload1.c


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29599


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug rtl-optimization/29599] [4.1/4.2/4.3 Regression] ICE when building the kernel on SH4
  2006-10-26  7:41 [Bug target/29599] New: [4.1/4.2 Regression] ICE when building the kernel on SH4 vapier at gentoo dot org
                   ` (9 preceding siblings ...)
  2007-02-18 23:08 ` kkojima at gcc dot gnu dot org
@ 2007-02-18 23:10 ` kkojima at gcc dot gnu dot org
  10 siblings, 0 replies; 12+ messages in thread
From: kkojima at gcc dot gnu dot org @ 2007-02-18 23:10 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #8 from kkojima at gcc dot gnu dot org  2007-02-18 23:10 -------
Fixed.


-- 

kkojima at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |FIXED


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29599


^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2007-02-18 23:10 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-10-26  7:41 [Bug target/29599] New: [4.1/4.2 Regression] ICE when building the kernel on SH4 vapier at gentoo dot org
2006-10-26  7:44 ` [Bug target/29599] " vapier at gentoo dot org
2006-10-29 16:47 ` [Bug target/29599] [4.1/4.2/4.3 " pinskia at gcc dot gnu dot org
2006-11-13  3:23 ` mmitchel at gcc dot gnu dot org
2006-12-06  0:40 ` kkojima at gcc dot gnu dot org
2007-02-07 21:40 ` patchapp at dberlin dot org
2007-02-08 23:55 ` [Bug rtl-optimization/29599] " kkojima at gcc dot gnu dot org
2007-02-10  6:48 ` kkojima at gcc dot gnu dot org
2007-02-14  9:40 ` mmitchel at gcc dot gnu dot org
2007-02-15  7:26 ` kkojima at gcc dot gnu dot org
2007-02-18 23:08 ` kkojima at gcc dot gnu dot org
2007-02-18 23:10 ` kkojima at gcc dot gnu dot org

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).