public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/49305] New: SH Target:  internal compiler error: in reload_cse_simplify_operands, at postreload.c:403
@ 2011-06-06 23:44 oleg.endo@t-online.de
  2011-06-07 14:04 ` [Bug target/49305] " kkojima at gcc dot gnu.org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: oleg.endo@t-online.de @ 2011-06-06 23:44 UTC (permalink / raw)
  To: gcc-bugs

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

           Summary: SH Target:  internal compiler error: in
                    reload_cse_simplify_operands, at postreload.c:403
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Severity: major
          Priority: P3
         Component: target
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: oleg.endo@t-online.de


When building newlib 1.19.0 it fails to build the SH2A lib:

sh-elf-gcc -B/home/y/code/gcc/newlib-1.19.0-build-sh-elf/sh-elf/m2a/newlib/
-isystem
/home/y/code/gcc/newlib-1.19.0-build-sh-elf/sh-elf/m2a/newlib/targ-include
-isystem /home/y/code/gcc/newlib-1.19.0/newlib/libc/include
-B/home/y/code/gcc/newlib-1.19.0-build-sh-elf/sh-elf/m2a/libgloss/sh
-L/home/y/code/gcc/newlib-1.19.0-build-sh-elf/sh-elf/m2a/libgloss/libnosys
-L/home/y/code/gcc/newlib-1.19.0/libgloss/sh  -m2a -DPACKAGE_NAME=\"newlib\"
-DPACKAGE_TARNAME=\"newlib\" -DPACKAGE_VERSION=\"1.19.0\"
-DPACKAGE_STRING=\"newlib\ 1.19.0\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE_URL=\"\"
-I. -I../../../../../../newlib-1.19.0/newlib/libc/stdio -fno-builtin      -Os
-mnomacsave -mpretend-cmove -mfused-madd -freg-struct-return  -m2a -c
../../../../../../newlib-1.19.0/newlib/libc/stdio/vfwscanf.c -o
lib_a-vfwscanf.o
../../../../../../newlib-1.19.0/newlib/libc/stdio/vfwscanf.c: In function
'__svfwscanf_r':
../../../../../../newlib-1.19.0/newlib/libc/stdio/vfwscanf.c:1454:1: error:
insn does not satisfy its constraints:
(insn 2358 4549 2359 471 (set (reg:SI 0 r0 [1023])
        (sign_extend:SI (mem/s:HI (plus:SI (reg:SI 2 r2)
                    (const_int 12 [0xc])) [5 fp_167(D)->_flags+0 S2 A32])))
../../../../../../newlib-1.19.0/newlib/libc/stdio/vfwscanf.c:1447 164
{*extendqisi2_compact}
     (nil))
../../../../../../newlib-1.19.0/newlib/libc/stdio/vfwscanf.c:1454:1: internal
compiler error: in reload_cse_simplify_operands, at postreload.c:403



sh-elf-gcc -v
Using built-in specs.
COLLECT_GCC=sh-elf-gcc
COLLECT_LTO_WRAPPER=/usr/local/libexec/gcc/sh-elf/4.7.0/lto-wrapper
Target: sh-elf
Configured with: ../gcc-trunk/configure --target=sh-elf --prefix=/usr/local
--enable-languages=c,c++ --enable-multilib --disable-libssp --without-headers
--disable-nls --disable-werror --enable-lto --with-newlib --with-gnu-as
--with-gnu-ld --with-system-zlib
Thread model: single
gcc version 4.7.0 20110606 (experimental) (GCC)


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

* [Bug target/49305] SH Target:  internal compiler error: in reload_cse_simplify_operands, at postreload.c:403
  2011-06-06 23:44 [Bug target/49305] New: SH Target: internal compiler error: in reload_cse_simplify_operands, at postreload.c:403 oleg.endo@t-online.de
@ 2011-06-07 14:04 ` kkojima at gcc dot gnu.org
  2011-06-07 14:06 ` kkojima at gcc dot gnu.org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: kkojima at gcc dot gnu.org @ 2011-06-07 14:04 UTC (permalink / raw)
  To: gcc-bugs

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

Kazumoto Kojima <kkojima at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |ice-on-valid-code
             Target|                            |sh2a-*-*
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2011.06.07 14:03:19
                 CC|                            |kkojima at gcc dot gnu.org
     Ever Confirmed|0                           |1

--- Comment #1 from Kazumoto Kojima <kkojima at gcc dot gnu.org> 2011-06-07 14:03:19 UTC ---
It seems that my recent patch

r174586 | kkojima | 2011-06-03 07:26:42 +0900 (Fri, 03 Jun 2011) | 7 lines

        * config/sh/predicates.md (general_movsrc_operand): Return 0
        for memory and memory subreg of which address is an invalid
        indexed address for QI and HImode.
        (general_movdst_operand): Likewise.

reveals a latent bug.  The insn

(insn 2358 4549 2359 471 (set (reg:SI 0 r0 [1023])
        (sign_extend:SI (mem/s:HI (plus:SI (reg:SI 2 r2)
                    (const_int 12 [0xc])) [5 fp_167(D)->_flags+0 S2 A32])))
../../../../../../newlib-1.19.0/newlib/libc/stdio/vfwscanf.c:1447 164
{*extendqisi2_compact}
     (nil))

has the pattern of *extendhisi2_compact but is strangely handled
as *extendqisi2_compact.  It looks the combined pass does this.
BTW, when looking into the PR, I've noticed that SH backend forgot
to use 32-bit mov.w instruction with 12-bit display for SH2A.
The patch below will work around this PR, though we should see
what is going on in the combined pass first.

diff -up ORIG/trunk/gcc/config/sh/sh.c trunk/gcc/config/sh/sh.c
--- ORIG/trunk/gcc/config/sh/sh.c    2011-06-02 09:41:16.000000000 +0900
+++ trunk/gcc/config/sh/sh.c    2011-06-07 20:25:49.000000000 +0900
@@ -9736,8 +9736,11 @@ sh_legitimate_index_p (enum machine_mode

       if (TARGET_SH2A)
     {
-      if (GET_MODE_SIZE (mode) == 1
-        && (unsigned) INTVAL (op) < 4096)
+      if ((GET_MODE_SIZE (mode) == 1
+           && (unsigned) INTVAL (op) < 4096)
+          || (GET_MODE_SIZE (mode) == 2
+          && (unsigned) INTVAL (op) < 8192
+          && !(INTVAL (op) & 1)))
         return true;
     }

diff -up ORIG/trunk/gcc/config/sh/sh.md trunk/gcc/config/sh/sh.md
--- ORIG/trunk/gcc/config/sh/sh.md    2010-08-28 13:32:01.000000000 +0900
+++ trunk/gcc/config/sh/sh.md    2011-06-07 20:33:58.000000000 +0900
@@ -4585,7 +4585,12 @@ label:
   "@
     exts.w    %1,%0
     mov.w    %1,%0"
-  [(set_attr "type" "arith,load")])
+  [(set_attr "type" "arith,load")
+   (set_attr_alternative "length"
+     [(const_int 2)
+       (if_then_else
+    (ne (symbol_ref "TARGET_SH2A") (const_int 0))
+    (const_int 4) (const_int 2))])])

 (define_insn "*extendhisi2_media"
   [(set (match_operand:SI 0 "register_operand" "=r,r")
@@ -5308,7 +5313,20 @@ label:
     sts    %1,%0
     lds    %1,%0
     fake    %1,%0"
-  [(set_attr "type" "pcload,move,load,move,store,move,move,pcload")])
+  [(set_attr "type" "pcload,move,load,move,store,move,move,pcload")
+   (set_attr_alternative "length"
+     [(const_int 2)
+      (const_int 2)
+      (if_then_else
+    (ne (symbol_ref "TARGET_SH2A") (const_int 0))
+    (const_int 4) (const_int 2))
+      (const_int 2)
+      (if_then_else
+    (ne (symbol_ref "TARGET_SH2A") (const_int 0))
+    (const_int 4) (const_int 2))
+      (const_int 2)
+      (const_int 2)
+      (const_int 2)])])

 (define_insn "*movhi_media"
   [(set (match_operand:HI 0 "general_movdst_operand"     "=r,r,r,r,m")


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

* [Bug target/49305] SH Target:  internal compiler error: in reload_cse_simplify_operands, at postreload.c:403
  2011-06-06 23:44 [Bug target/49305] New: SH Target: internal compiler error: in reload_cse_simplify_operands, at postreload.c:403 oleg.endo@t-online.de
  2011-06-07 14:04 ` [Bug target/49305] " kkojima at gcc dot gnu.org
@ 2011-06-07 14:06 ` kkojima at gcc dot gnu.org
  2011-06-08 14:03 ` kkojima at gcc dot gnu.org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: kkojima at gcc dot gnu.org @ 2011-06-07 14:06 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Kazumoto Kojima <kkojima at gcc dot gnu.org> 2011-06-07 14:05:50 UTC ---
Created attachment 24457
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=24457
A reduced testcase


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

* [Bug target/49305] SH Target:  internal compiler error: in reload_cse_simplify_operands, at postreload.c:403
  2011-06-06 23:44 [Bug target/49305] New: SH Target: internal compiler error: in reload_cse_simplify_operands, at postreload.c:403 oleg.endo@t-online.de
  2011-06-07 14:04 ` [Bug target/49305] " kkojima at gcc dot gnu.org
  2011-06-07 14:06 ` kkojima at gcc dot gnu.org
@ 2011-06-08 14:03 ` kkojima at gcc dot gnu.org
  2011-06-08 23:14 ` kkojima at gcc dot gnu.org
  2011-06-08 23:17 ` kkojima at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: kkojima at gcc dot gnu.org @ 2011-06-08 14:03 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Kazumoto Kojima <kkojima at gcc dot gnu.org> 2011-06-08 14:03:02 UTC ---
It's my fault after all.  The patch r174586 should check the mode
parameter too.  Without checking mode, insn-recog routines are
confused and the combine pass makes insns with wrong insn_code.
Now I'm testing

--- ORIG/trunk/gcc/config/sh/predicates.md    2011-06-04 10:16:51.000000000
+0900
+++ trunk/gcc/config/sh/predicates.md    2011-06-08 18:55:09.000000000 +0900
@@ -395,6 +395,7 @@
     }

   if ((mode == QImode || mode == HImode)
+      && mode == GET_MODE (op)
       && (MEM_P (op)
       || (GET_CODE (op) == SUBREG && MEM_P (SUBREG_REG (op)))))
     {
@@ -432,6 +433,7 @@
     return 0;

   if ((mode == QImode || mode == HImode)
+      && mode == GET_MODE (op)
       && (MEM_P (op)
       || (GET_CODE (op) == SUBREG && MEM_P (SUBREG_REG (op)))))
     {

I'll apply it if it survives the tests on sh-elf and sh4-unknown-linux-gnu
and put the patch in #1 into my TODO list.


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

* [Bug target/49305] SH Target:  internal compiler error: in reload_cse_simplify_operands, at postreload.c:403
  2011-06-06 23:44 [Bug target/49305] New: SH Target: internal compiler error: in reload_cse_simplify_operands, at postreload.c:403 oleg.endo@t-online.de
                   ` (2 preceding siblings ...)
  2011-06-08 14:03 ` kkojima at gcc dot gnu.org
@ 2011-06-08 23:14 ` kkojima at gcc dot gnu.org
  2011-06-08 23:17 ` kkojima at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: kkojima at gcc dot gnu.org @ 2011-06-08 23:14 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Kazumoto Kojima <kkojima at gcc dot gnu.org> 2011-06-08 23:13:30 UTC ---
Author: kkojima
Date: Wed Jun  8 23:13:27 2011
New Revision: 174824

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=174824
Log:
    PR target/49305
    * config/sh/predicates.md (general_movsrc_operand): Check
    mode for memory with indexed address for QI and HImode.
    (general_movdst_operand): Likewise.


Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/config/sh/predicates.md


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

* [Bug target/49305] SH Target:  internal compiler error: in reload_cse_simplify_operands, at postreload.c:403
  2011-06-06 23:44 [Bug target/49305] New: SH Target: internal compiler error: in reload_cse_simplify_operands, at postreload.c:403 oleg.endo@t-online.de
                   ` (3 preceding siblings ...)
  2011-06-08 23:14 ` kkojima at gcc dot gnu.org
@ 2011-06-08 23:17 ` kkojima at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: kkojima at gcc dot gnu.org @ 2011-06-08 23:17 UTC (permalink / raw)
  To: gcc-bugs

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

Kazumoto Kojima <kkojima at gcc dot gnu.org> changed:

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

--- Comment #5 from Kazumoto Kojima <kkojima at gcc dot gnu.org> 2011-06-08 23:17:08 UTC ---
Fixed.


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

end of thread, other threads:[~2011-06-08 23:17 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-06-06 23:44 [Bug target/49305] New: SH Target: internal compiler error: in reload_cse_simplify_operands, at postreload.c:403 oleg.endo@t-online.de
2011-06-07 14:04 ` [Bug target/49305] " kkojima at gcc dot gnu.org
2011-06-07 14:06 ` kkojima at gcc dot gnu.org
2011-06-08 14:03 ` kkojima at gcc dot gnu.org
2011-06-08 23:14 ` kkojima at gcc dot gnu.org
2011-06-08 23:17 ` kkojima at gcc dot gnu.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).