public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug rtl-optimization/52170] New: ICE in trunc_int_for_mode, at explow.c:57 during simplify_plus_minus
@ 2012-02-08 11:23 Greta.Yorsh at arm dot com
  2012-02-08 11:32 ` [Bug rtl-optimization/52170] " rguenth at gcc dot gnu.org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: Greta.Yorsh at arm dot com @ 2012-02-08 11:23 UTC (permalink / raw)
  To: gcc-bugs

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

             Bug #: 52170
           Summary: ICE in trunc_int_for_mode, at explow.c:57 during
                    simplify_plus_minus
    Classification: Unclassified
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: rtl-optimization
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: Greta.Yorsh@arm.com


Created attachment 26609
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=26609
testcase that triggers the ICE

cc1 -quiet -mcpu=cortex-a9 -mfloat-abi=softfp -mfpu=neon -O3 smallest.c
smallest.c: In function 'f0a':
smallest.c:24:1: internal compiler error: in trunc_int_for_mode, at explow.c:57

57: gcc_assert (SCALAR_INT_MODE_P (mode));

(gdb) info stack
#0  fancy_abort (file=0x132ccd0 "/work/local-checkouts/gcc-fsf/gcc/explow.c",
line=57, function=0x132d130 "trunc_int_for_mode") at
/work/local-checkouts/gcc-fsf/gcc/diagnostic.c:899
#1  0x0000000000753919 in trunc_int_for_mode (c=1, mode=V16QImode) at
/work/local-checkouts/gcc-fsf/gcc/explow.c:57
#2  0x000000000073c90f in gen_int_mode (c=1, mode=V16QImode) at
/work/local-checkouts/gcc-fsf/gcc/emit-rtl.c:421
#3  0x0000000000adba40 in neg_const_int (mode=V16QImode, i=0x7ffff765c460) at
/work/local-checkouts/gcc-fsf/gcc/simplify-rtx.c:70
#4  0x0000000000ae96bf in simplify_plus_minus (code=MINUS, mode=V16QImode,
op0=0x7ffff75f17e0, op1=0x7ffff76010e0) at
/work/local-checkouts/gcc-fsf/gcc/simplify-rtx.c:3963
#5  0x0000000000ae2e20 in simplify_binary_operation_1 (code=MINUS,
mode=V16QImode, op0=0x7ffff75f17e0, op1=0x7ffff76010e0, trueop0=0x7ffff75f17e0,
trueop1=0x7ffff76010e0) at
/work/local-checkouts/gcc-fsf/gcc/simplify-rtx.c:2307
#6  0x0000000000ae1049 in simplify_binary_operation (code=MINUS,
mode=V16QImode, op0=0x7ffff75f17e0, op1=0x7ffff76010e0) at
/work/local-checkouts/gcc-fsf/gcc/simplify-rtx.c:1909
#7  0x0000000001116fe8 in combine_simplify_rtx (x=0x7ffff75f1828,
op0_mode=V16QImode, in_dest=0, in_cond=0) at
/work/local-checkouts/gcc-fsf/gcc/combine.c:5459
#8  0x000000000111688a in subst (x=0x7ffff75f1828, from=0x7ffff75ff800,
to=0x7ffff75f17e0, in_dest=0, in_cond=0, unique_copy=0) at
/work/local-checkouts/gcc-fsf/gcc/combine.c:5292
#9  0x0000000001116674 in subst (x=0x7ffff75f1840, from=0x7ffff75ff800,
to=0x7ffff75f17e0, in_dest=0, in_cond=0, unique_copy=0) at
/work/local-checkouts/gcc-fsf/gcc/combine.c:5228
#10 0x0000000001110569 in try_combine (i3=0x7ffff7600678, i2=0x7ffff7600630,
i1=0x7ffff76005e8, i0=0x0, new_direct_jump_p=0x7fffffffe05c,
last_combined_insn=0x7ffff7600678) at
/work/local-checkouts/gcc-fsf/gcc/combine.c:3253
#11 0x000000000110b0d8 in combine_instructions (f=0x7ffff75c4a00, nregs=582) at
/work/local-checkouts/gcc-fsf/gcc/combine.c:1340
#12 0x000000000112be4d in rest_of_handle_combine () at
/work/local-checkouts/gcc-fsf/gcc/combine.c:13953
#13 0x0000000000a238cf in execute_one_pass (pass=0x18e6500) at
/work/local-checkouts/gcc-fsf/gcc/passes.c:2081
#14 0x0000000000a23abd in execute_pass_list (pass=0x18e6500) at
/work/local-checkouts/gcc-fsf/gcc/passes.c:2136
#15 0x0000000000a23ade in execute_pass_list (pass=0x18dcb40) at
/work/local-checkouts/gcc-fsf/gcc/passes.c:2137
#16 0x0000000000bc8d2a in tree_rest_of_compilation (fndecl=0x7ffff759c300) at
/work/local-checkouts/gcc-fsf/gcc/tree-optimize.c:422
#17 0x000000000069e420 in cgraph_expand_function (node=0x7ffff75c1000) at
/work/local-checkouts/gcc-fsf/gcc/cgraphunit.c:1829
#18 0x000000000069e5eb in cgraph_expand_all_functions () at
/work/local-checkouts/gcc-fsf/gcc/cgraphunit.c:1896
#19 0x000000000069f131 in cgraph_optimize () at
/work/local-checkouts/gcc-fsf/gcc/cgraphunit.c:2210
#20 0x000000000069c16d in cgraph_finalize_compilation_unit () at
/work/local-checkouts/gcc-fsf/gcc/cgraphunit.c:1338
#21 0x00000000004cd66d in c_write_global_declarations () at
/work/local-checkouts/gcc-fsf/gcc/c-decl.c:10030
#22 0x0000000000b1634a in compile_file () at
/work/local-checkouts/gcc-fsf/gcc/toplev.c:573
#23 0x0000000000b185a8 in do_compile () at
/work/local-checkouts/gcc-fsf/gcc/toplev.c:1938
#24 0x0000000000b1871f in toplev_main (argc=7, argv=0x7fffffffe448) at
/work/local-checkouts/gcc-fsf/gcc/toplev.c:2014
#25 0x00000000005ce980 in main (argc=7, argv=0x7fffffffe448) at
/work/local-checkouts/gcc-fsf/gcc/main.c:36

Fails on trunk. 

The problem seems to be that the "mode" argument of simplify_plus_minus, which
satisfies INTEGRAL_MODE_P (mode), is passed on to trunc_int_for_mode, which
requires stronger SCALAR_INT_MODE_P (mode). The assert fails in the attached
test case, because the mode is V16QImode a vector mode not scalar mode.


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

* [Bug rtl-optimization/52170] ICE in trunc_int_for_mode, at explow.c:57 during simplify_plus_minus
  2012-02-08 11:23 [Bug rtl-optimization/52170] New: ICE in trunc_int_for_mode, at explow.c:57 during simplify_plus_minus Greta.Yorsh at arm dot com
@ 2012-02-08 11:32 ` rguenth at gcc dot gnu.org
  2012-02-08 11:38 ` rguenth at gcc dot gnu.org
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: rguenth at gcc dot gnu.org @ 2012-02-08 11:32 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Richard Guenther <rguenth at gcc dot gnu.org> 2012-02-08 11:32:12 UTC ---
#3  0x0000000000adba40 in neg_const_int (mode=V16QImode, i=0x7ffff765c460) at
/work/local-checkouts/gcc-fsf/gcc/simplify-rtx.c:70
#4  0x0000000000ae96bf in simplify_plus_minus (code=MINUS, mode=V16QImode,
op0=0x7ffff75f17e0, op1=0x7ffff76010e0) at
/work/local-checkouts/gcc-fsf/gcc/simplify-rtx.c:3963

V16QImode constants should not use CONST_INT but CONST_VECTOR.


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

* [Bug rtl-optimization/52170] ICE in trunc_int_for_mode, at explow.c:57 during simplify_plus_minus
  2012-02-08 11:23 [Bug rtl-optimization/52170] New: ICE in trunc_int_for_mode, at explow.c:57 during simplify_plus_minus Greta.Yorsh at arm dot com
  2012-02-08 11:32 ` [Bug rtl-optimization/52170] " rguenth at gcc dot gnu.org
@ 2012-02-08 11:38 ` rguenth at gcc dot gnu.org
  2012-02-08 11:39 ` rguenth at gcc dot gnu.org
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: rguenth at gcc dot gnu.org @ 2012-02-08 11:38 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2012-02-08
     Ever Confirmed|0                           |1

--- Comment #2 from Richard Guenther <rguenth at gcc dot gnu.org> 2012-02-08 11:38:15 UTC ---
Caused by

            case NOT:
              /* ~a -> (-a - 1) */
              if (n_ops != 7)
                {
                  ops[n_ops].op = constm1_rtx;
                  ops[n_ops++].neg = this_neg;
                  ops[i].op = XEXP (this_op, 0);
                  ops[i].neg = !this_neg;
                  changed = 1;
                  canonicalized = 1;
                }
              break;

fixed by

Index: gcc/simplify-rtx.c
===================================================================
--- gcc/simplify-rtx.c  (revision 183997)
+++ gcc/simplify-rtx.c  (working copy)
@@ -3945,7 +3945,8 @@ simplify_plus_minus (enum rtx_code code,

            case NOT:
              /* ~a -> (-a - 1) */
-             if (n_ops != 7)
+             if (n_ops != 7
+                 && SCALAR_INT_MODE_P (GET_MODE (this_op)))
                {
                  ops[n_ops].op = constm1_rtx;
                  ops[n_ops++].neg = this_neg;

or by using a proper constant instead of constm1_rtx.


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

* [Bug rtl-optimization/52170] ICE in trunc_int_for_mode, at explow.c:57 during simplify_plus_minus
  2012-02-08 11:23 [Bug rtl-optimization/52170] New: ICE in trunc_int_for_mode, at explow.c:57 during simplify_plus_minus Greta.Yorsh at arm dot com
  2012-02-08 11:32 ` [Bug rtl-optimization/52170] " rguenth at gcc dot gnu.org
  2012-02-08 11:38 ` rguenth at gcc dot gnu.org
@ 2012-02-08 11:39 ` rguenth at gcc dot gnu.org
  2012-02-08 11:44 ` [Bug rtl-optimization/52170] [4.7 Regression] " rguenth at gcc dot gnu.org
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: rguenth at gcc dot gnu.org @ 2012-02-08 11:39 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Target|                            |arm-*-*, x86_64-*-*,
                   |                            |i?86-*-*

--- Comment #3 from Richard Guenther <rguenth at gcc dot gnu.org> 2012-02-08 11:39:32 UTC ---
Also ICEs on x86_64.


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

* [Bug rtl-optimization/52170] [4.7 Regression] ICE in trunc_int_for_mode, at explow.c:57 during simplify_plus_minus
  2012-02-08 11:23 [Bug rtl-optimization/52170] New: ICE in trunc_int_for_mode, at explow.c:57 during simplify_plus_minus Greta.Yorsh at arm dot com
                   ` (2 preceding siblings ...)
  2012-02-08 11:39 ` rguenth at gcc dot gnu.org
@ 2012-02-08 11:44 ` rguenth at gcc dot gnu.org
  2012-02-08 11:47 ` rguenth at gcc dot gnu.org
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: rguenth at gcc dot gnu.org @ 2012-02-08 11:44 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |ice-on-valid-code
             Status|NEW                         |ASSIGNED
      Known to work|                            |4.6.3
         AssignedTo|unassigned at gcc dot       |rguenth at gcc dot gnu.org
                   |gnu.org                     |
   Target Milestone|---                         |4.7.0
            Summary|ICE in trunc_int_for_mode,  |[4.7 Regression] ICE in
                   |at explow.c:57 during       |trunc_int_for_mode, at
                   |simplify_plus_minus         |explow.c:57 during
                   |                            |simplify_plus_minus

--- Comment #4 from Richard Guenther <rguenth at gcc dot gnu.org> 2012-02-08 11:44:20 UTC ---
Like

Index: simplify-rtx.c
===================================================================
--- simplify-rtx.c      (revision 183997)
+++ simplify-rtx.c      (working copy)
@@ -3947,7 +3947,7 @@ simplify_plus_minus (enum rtx_code code,
              /* ~a -> (-a - 1) */
              if (n_ops != 7)
                {
-                 ops[n_ops].op = constm1_rtx;
+                 ops[n_ops].op = CONSTM1_RTX (GET_MODE (this_op));
                  ops[n_ops++].neg = this_neg;
                  ops[i].op = XEXP (this_op, 0);
                  ops[i].neg = !this_neg;

Mine.


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

* [Bug rtl-optimization/52170] [4.7 Regression] ICE in trunc_int_for_mode, at explow.c:57 during simplify_plus_minus
  2012-02-08 11:23 [Bug rtl-optimization/52170] New: ICE in trunc_int_for_mode, at explow.c:57 during simplify_plus_minus Greta.Yorsh at arm dot com
                   ` (3 preceding siblings ...)
  2012-02-08 11:44 ` [Bug rtl-optimization/52170] [4.7 Regression] " rguenth at gcc dot gnu.org
@ 2012-02-08 11:47 ` rguenth at gcc dot gnu.org
  2012-02-08 13:30 ` rguenth at gcc dot gnu.org
  2012-02-08 13:30 ` rguenth at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: rguenth at gcc dot gnu.org @ 2012-02-08 11:47 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from Richard Guenther <rguenth at gcc dot gnu.org> 2012-02-08 11:46:35 UTC ---
There are some missed optimizations in simplify-rtx.c, obvious if you look
at uses of const*_rtx.


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

* [Bug rtl-optimization/52170] [4.7 Regression] ICE in trunc_int_for_mode, at explow.c:57 during simplify_plus_minus
  2012-02-08 11:23 [Bug rtl-optimization/52170] New: ICE in trunc_int_for_mode, at explow.c:57 during simplify_plus_minus Greta.Yorsh at arm dot com
                   ` (4 preceding siblings ...)
  2012-02-08 11:47 ` rguenth at gcc dot gnu.org
@ 2012-02-08 13:30 ` rguenth at gcc dot gnu.org
  2012-02-08 13:30 ` rguenth at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: rguenth at gcc dot gnu.org @ 2012-02-08 13:30 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from Richard Guenther <rguenth at gcc dot gnu.org> 2012-02-08 13:29:28 UTC ---
Author: rguenth
Date: Wed Feb  8 13:29:22 2012
New Revision: 184007

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=184007
Log:
2012-02-08  Richard Guenther  <rguenther@suse.de>

    PR rtl-optimization/52170
    * simplify-rtx.c (simplify_plus_minus): Use CONSTM1_RTX to
    properly handle integer vector modes.

    * gcc.dg/torture/pr52170.c: New testcase.

Added:
    trunk/gcc/testsuite/gcc.dg/torture/pr52170.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/simplify-rtx.c
    trunk/gcc/testsuite/ChangeLog


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

* [Bug rtl-optimization/52170] [4.7 Regression] ICE in trunc_int_for_mode, at explow.c:57 during simplify_plus_minus
  2012-02-08 11:23 [Bug rtl-optimization/52170] New: ICE in trunc_int_for_mode, at explow.c:57 during simplify_plus_minus Greta.Yorsh at arm dot com
                   ` (5 preceding siblings ...)
  2012-02-08 13:30 ` rguenth at gcc dot gnu.org
@ 2012-02-08 13:30 ` rguenth at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: rguenth at gcc dot gnu.org @ 2012-02-08 13:30 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #7 from Richard Guenther <rguenth at gcc dot gnu.org> 2012-02-08 13:29:43 UTC ---
Fixed.


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

end of thread, other threads:[~2012-02-08 13:30 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-02-08 11:23 [Bug rtl-optimization/52170] New: ICE in trunc_int_for_mode, at explow.c:57 during simplify_plus_minus Greta.Yorsh at arm dot com
2012-02-08 11:32 ` [Bug rtl-optimization/52170] " rguenth at gcc dot gnu.org
2012-02-08 11:38 ` rguenth at gcc dot gnu.org
2012-02-08 11:39 ` rguenth at gcc dot gnu.org
2012-02-08 11:44 ` [Bug rtl-optimization/52170] [4.7 Regression] " rguenth at gcc dot gnu.org
2012-02-08 11:47 ` rguenth at gcc dot gnu.org
2012-02-08 13:30 ` rguenth at gcc dot gnu.org
2012-02-08 13:30 ` rguenth 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).