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.