public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug middle-end/65163] New: [5 Regression][SH] ICE in decompose at rtl.h:2007
@ 2015-02-22 13:17 olegendo at gcc dot gnu.org
  2015-02-22 13:48 ` [Bug target/65163] " olegendo at gcc dot gnu.org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: olegendo at gcc dot gnu.org @ 2015-02-22 13:17 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65163

            Bug ID: 65163
           Summary: [5 Regression][SH] ICE in decompose at rtl.h:2007
           Product: gcc
           Version: 5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: middle-end
          Assignee: unassigned at gcc dot gnu.org
          Reporter: olegendo at gcc dot gnu.org
            Target: sh*-*-*

The following example:

typedef unsigned int uint32_t;
union unaligned_32 { uint32_t l; } __attribute__((packed));

int
test (unsigned char* buf, int bits_per_component)
{
  (((union unaligned_32 *)(buf))->l) = __builtin_bswap32 (bits_per_component ==
10 ? 1 : 0);

  return 0;
}


compiled with -m4 -ml -O2 results in:

 internal compiler error: in decompose, at rtl.h:2007
 }
 ^
0x8708fa1 wi::int_traits<std::pair<rtx_def*, machine_mode> >::decompose(long
long*, unsigned int, std::pair<rtx_def*, machine_mode> const&)
    ../../gcc-trunk/gcc/rtl.h:2005
0x8708fa1 wi::int_traits<std::pair<rtx_def*, machine_mode> >::decompose(long
long*, unsigned int, std::pair<rtx_def*, machine_mode> const&)
    ../../gcc-trunk/gcc/simplify-rtx.c:3717
0x8708fa1 wide_int_ref_storage<std::pair<rtx_def*, machine_mode> >
    ../../gcc-trunk/gcc/wide-int.h:948
0x8708fa1 generic_wide_int<std::pair<rtx_def*, machine_mode> >
    ../../gcc-trunk/gcc/wide-int.h:725
0x8708fa1 neg_p<std::pair<rtx_def*, machine_mode> >
    ../../gcc-trunk/gcc/wide-int.h:1694
0x8708fa1 simplify_const_binary_operation(rtx_code, machine_mode, rtx_def*,
rtx_def*)
    ../../gcc-trunk/gcc/simplify-rtx.c:4029
0x87077e3 simplify_binary_operation(rtx_code, machine_mode, rtx_def*, rtx_def*)
    ../../gcc-trunk/gcc/simplify-rtx.c:1987
0x870a9b6 simplify_gen_binary
    ../../gcc-trunk/gcc/simplify-rtx.c:212
0x8b6b047 if_then_else_cond
    ../../gcc-trunk/gcc/combine.c:8885
0x8b73a22 combine_simplify_rtx
    ../../gcc-trunk/gcc/combine.c:5492
0x8b7679f subst
    ../../gcc-trunk/gcc/combine.c:5429
0x8b76518 subst
    ../../gcc-trunk/gcc/combine.c:5374
0x8b76518 subst
    ../../gcc-trunk/gcc/combine.c:5374
0x8b78f03 try_combine
    ../../gcc-trunk/gcc/combine.c:3273
0x8b7f44f combine_instructions
    ../../gcc-trunk/gcc/combine.c:1309
0x8b7f44f rest_of_handle_combine
    ../../gcc-trunk/gcc/combine.c:14194
0x8b7f44f execute
    ../../gcc-trunk/gcc/combine.c:14237

... when combine tries to simplify the following rtx:

(and:SI (rotate:SI (reg:SI 170)
        (const_int 16 [0x10]))
    (const_int 4294901760 [0xffff0000]))

The problem is that in sh.md the constant 0xffff0000 is not written as sign
extended hwi values.

It's actually a latent bug, which seems to have gone unnoticed so far.


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

* [Bug target/65163] [5 Regression][SH] ICE in decompose at rtl.h:2007
  2015-02-22 13:17 [Bug middle-end/65163] New: [5 Regression][SH] ICE in decompose at rtl.h:2007 olegendo at gcc dot gnu.org
@ 2015-02-22 13:48 ` olegendo at gcc dot gnu.org
  2015-02-23 10:18 ` rguenth at gcc dot gnu.org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: olegendo at gcc dot gnu.org @ 2015-02-22 13:48 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65163

Oleg Endo <olegendo at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2015-02-22
          Component|middle-end                  |target
     Ever confirmed|0                           |1

--- Comment #1 from Oleg Endo <olegendo at gcc dot gnu.org> ---
The following seems to fix the issue:

Index: gcc/config/sh/sh.md
===================================================================
--- gcc/config/sh/sh.md    (revision 220892)
+++ gcc/config/sh/sh.md    (working copy)
@@ -6218,7 +6218,7 @@
 (define_insn "swapbsi2"
   [(set (match_operand:SI 0 "arith_reg_dest" "=r")
     (ior:SI (and:SI (match_operand:SI 1 "arith_reg_operand" "r")
-            (const_int 4294901760))
+            (const_int -65536)) ;; 0xFFFF0000
         (ior:SI (and:SI (ashift:SI (match_dup 1) (const_int 8))
                 (const_int 65280))
             (and:SI (ashiftrt:SI (match_dup 1) (const_int 8))
@@ -6286,7 +6286,7 @@
 (define_peephole2
   [(set (match_operand:SI 0 "arith_reg_dest" "")
     (ior:SI (and:SI (match_operand:SI 1 "arith_reg_operand" "")
-            (const_int 4294901760))
+            (const_int -65536)) ;; 0xFFFF0000
         (ior:SI (and:SI (ashift:SI (match_dup 1) (const_int 8))
                 (const_int 65280))
             (and:SI (ashiftrt:SI (match_dup 1) (const_int 8))
@@ -6296,7 +6296,7 @@
   "TARGET_SH1 && peep2_reg_dead_p (2, operands[0])"
   [(set (match_dup 2)
     (ior:SI (and:SI (match_operand:SI 1 "arith_reg_operand" "")
-            (const_int 4294901760))
+            (const_int -65536)) ;; 0xFFFF0000
         (ior:SI (and:SI (ashift:SI (match_dup 1) (const_int 8))
                 (const_int 65280))
             (and:SI (ashiftrt:SI (match_dup 1) (const_int 8))


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

* [Bug target/65163] [5 Regression][SH] ICE in decompose at rtl.h:2007
  2015-02-22 13:17 [Bug middle-end/65163] New: [5 Regression][SH] ICE in decompose at rtl.h:2007 olegendo at gcc dot gnu.org
  2015-02-22 13:48 ` [Bug target/65163] " olegendo at gcc dot gnu.org
@ 2015-02-23 10:18 ` rguenth at gcc dot gnu.org
  2015-02-23 20:21 ` olegendo at gcc dot gnu.org
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: rguenth at gcc dot gnu.org @ 2015-02-23 10:18 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65163

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P4
   Target Milestone|---                         |5.0


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

* [Bug target/65163] [5 Regression][SH] ICE in decompose at rtl.h:2007
  2015-02-22 13:17 [Bug middle-end/65163] New: [5 Regression][SH] ICE in decompose at rtl.h:2007 olegendo at gcc dot gnu.org
  2015-02-22 13:48 ` [Bug target/65163] " olegendo at gcc dot gnu.org
  2015-02-23 10:18 ` rguenth at gcc dot gnu.org
@ 2015-02-23 20:21 ` olegendo at gcc dot gnu.org
  2015-02-23 21:06 ` olegendo at gcc dot gnu.org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: olegendo at gcc dot gnu.org @ 2015-02-23 20:21 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65163

--- Comment #2 from Oleg Endo <olegendo at gcc dot gnu.org> ---
Author: olegendo
Date: Mon Feb 23 19:16:34 2015
New Revision: 220916

URL: https://gcc.gnu.org/viewcvs?rev=220916&root=gcc&view=rev
Log:
gcc/
    PR target/65163
    * config/sh/sh.md (swapbsi2, related peephole2): Use const_int -65536
    instead of const_int 4294901760.

gcc/testsuite/
    PR target/65163
    * gcc.c-torture/compile/pr65163.c: New.

Added:
    trunk/gcc/testsuite/gcc.c-torture/compile/pr65163.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/config/sh/sh.md
    trunk/gcc/testsuite/ChangeLog


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

* [Bug target/65163] [5 Regression][SH] ICE in decompose at rtl.h:2007
  2015-02-22 13:17 [Bug middle-end/65163] New: [5 Regression][SH] ICE in decompose at rtl.h:2007 olegendo at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2015-02-23 20:21 ` olegendo at gcc dot gnu.org
@ 2015-02-23 21:06 ` olegendo at gcc dot gnu.org
  2015-02-23 21:06 ` olegendo at gcc dot gnu.org
  2015-02-23 21:46 ` olegendo at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: olegendo at gcc dot gnu.org @ 2015-02-23 21:06 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65163

--- Comment #3 from Oleg Endo <olegendo at gcc dot gnu.org> ---
Author: olegendo
Date: Mon Feb 23 20:37:20 2015
New Revision: 220917

URL: https://gcc.gnu.org/viewcvs?rev=220917&root=gcc&view=rev
Log:
gcc/
    Backport from mainline
    2015-02-23  Oleg Endo  <olegendo@gcc.gnu.org>

    PR target/65163
    * config/sh/sh.md (swapbsi2, related peephole2): Use const_int -65536
    instead of const_int 4294901760.

gcc/testsuite/
    Backport from mainline
    2015-02-23  Oleg Endo  <olegendo@gcc.gnu.org>

    PR target/65163
    * gcc.c-torture/compile/pr65163.c: New.

Added:
    branches/gcc-4_9-branch/gcc/testsuite/gcc.c-torture/compile/pr65163.c
Modified:
    branches/gcc-4_9-branch/gcc/ChangeLog
    branches/gcc-4_9-branch/gcc/config/sh/sh.md
    branches/gcc-4_9-branch/gcc/testsuite/ChangeLog


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

* [Bug target/65163] [5 Regression][SH] ICE in decompose at rtl.h:2007
  2015-02-22 13:17 [Bug middle-end/65163] New: [5 Regression][SH] ICE in decompose at rtl.h:2007 olegendo at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2015-02-23 21:06 ` olegendo at gcc dot gnu.org
@ 2015-02-23 21:06 ` olegendo at gcc dot gnu.org
  2015-02-23 21:46 ` olegendo at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: olegendo at gcc dot gnu.org @ 2015-02-23 21:06 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65163

--- Comment #4 from Oleg Endo <olegendo at gcc dot gnu.org> ---
Author: olegendo
Date: Mon Feb 23 20:40:45 2015
New Revision: 220918

URL: https://gcc.gnu.org/viewcvs?rev=220918&root=gcc&view=rev
Log:
gcc/
    Backport from mainline
    2015-02-23  Oleg Endo  <olegendo@gcc.gnu.org>

    PR target/65163
    * config/sh/sh.md (swapbsi2, related peephole2): Use const_int -65536
    instead of const_int 4294901760.

gcc/testsuite/
    Backport from mainline
    2015-02-23  Oleg Endo  <olegendo@gcc.gnu.org>

    PR target/65163
    * gcc.c-torture/compile/pr65163.c: New.

Added:
    branches/gcc-4_8-branch/gcc/testsuite/gcc.c-torture/compile/pr65163.c
Modified:
    branches/gcc-4_8-branch/gcc/ChangeLog
    branches/gcc-4_8-branch/gcc/config/sh/sh.md
    branches/gcc-4_8-branch/gcc/testsuite/ChangeLog


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

* [Bug target/65163] [5 Regression][SH] ICE in decompose at rtl.h:2007
  2015-02-22 13:17 [Bug middle-end/65163] New: [5 Regression][SH] ICE in decompose at rtl.h:2007 olegendo at gcc dot gnu.org
                   ` (4 preceding siblings ...)
  2015-02-23 21:06 ` olegendo at gcc dot gnu.org
@ 2015-02-23 21:46 ` olegendo at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: olegendo at gcc dot gnu.org @ 2015-02-23 21:46 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65163

Oleg Endo <olegendo at gcc dot gnu.org> changed:

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

--- Comment #5 from Oleg Endo <olegendo at gcc dot gnu.org> ---
Fixed on trunk, 4.9 and 4.8.


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

end of thread, other threads:[~2015-02-23 20:47 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-02-22 13:17 [Bug middle-end/65163] New: [5 Regression][SH] ICE in decompose at rtl.h:2007 olegendo at gcc dot gnu.org
2015-02-22 13:48 ` [Bug target/65163] " olegendo at gcc dot gnu.org
2015-02-23 10:18 ` rguenth at gcc dot gnu.org
2015-02-23 20:21 ` olegendo at gcc dot gnu.org
2015-02-23 21:06 ` olegendo at gcc dot gnu.org
2015-02-23 21:06 ` olegendo at gcc dot gnu.org
2015-02-23 21:46 ` olegendo 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).