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

Uroš Bizjak <ubizjak at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2013-10-28
      Known to work|                            |4.9.0
            Summary|ICE in combine.c when using |[4.8 Regression] ICE in
                   |-Os on alpha                |combine.c when using -Os on
                   |                            |alpha
     Ever confirmed|0                           |1

--- Comment #1 from Uroš Bizjak <ubizjak at gmail dot com> ---
Confirmed with 4.8.3 using crosscompiler from x86_64-pc-linux-gnu to
alpha-linux-gnu. 4.9 works OK (but the failure can be latent there).

Reduced testcase:

--cut here--
typedef unsigned char u8;

static inline u8 foo (const u8 * tsp)
{
  if (tsp[4] > 183)
    return 0;
  return 183 - tsp[4];
}

u8 bar (const u8 * buf)
{
  u8 count;

  count = foo (buf);
  if (count == 0)
    return -1;

  return count;
}
--cut here--

gcc -O2:

t.c: In function ‘bar’:
t.c:19:1: internal compiler error: in do_SUBST, at combine.c:711
 }
 ^
0x96532c do_SUBST
        /home/uros/gcc-svn/branches/gcc-4_8-branch/gcc/combine.c:710
0x97374c combine_simplify_rtx
        /home/uros/gcc-svn/branches/gcc-4_8-branch/gcc/combine.c:5808
0x974a22 subst
        /home/uros/gcc-svn/branches/gcc-4_8-branch/gcc/combine.c:5155
0x974618 subst
        /home/uros/gcc-svn/branches/gcc-4_8-branch/gcc/combine.c:5100
0x974618 subst
        /home/uros/gcc-svn/branches/gcc-4_8-branch/gcc/combine.c:5100
0x975a8d try_combine
        /home/uros/gcc-svn/branches/gcc-4_8-branch/gcc/combine.c:3146
0x97a5e1 combine_instructions
        /home/uros/gcc-svn/branches/gcc-4_8-branch/gcc/combine.c:1368
0x97a5e1 rest_of_handle_combine
        /home/uros/gcc-svn/branches/gcc-4_8-branch/gcc/combine.c:13809

(gdb) up
#2  0x000000000096532d in do_SUBST (into=into@entry=0x7ffff19b08f8,
newval=0x7ffff1984830) at
/home/uros/gcc-svn/branches/gcc-4_8-branch/gcc/combine.c:710
710           gcc_assert (INTVAL (newval)
(gdb) list
705       if (GET_MODE_CLASS (GET_MODE (oldval)) == MODE_INT
706           && CONST_INT_P (newval))
707         {
708           /* Sanity check that we're replacing oldval with a CONST_INT
709              that is a valid sign-extension for the original mode.  */
710           gcc_assert (INTVAL (newval)
711                       == trunc_int_for_mode (INTVAL (newval), GET_MODE
(oldval)));
712
713           /* Replacing the operand of a SUBREG or a ZERO_EXTEND with a
714              CONST_INT is not valid, because after the replacement, the

(gdb) p debug_rtx (newval)
(const_int 183 [0xb7])
$3 = void
(gdb) p debug_rtx (oldval)
(subreg:QI (reg:DI 71 [ D.1406 ]) 0)
$4 = void

The value 183 is too big for QImode.

Reply via email to