Hi, I've committed the following fix for PR 67506 as r227646 on trunk and as r227647 on the gcc-5 branch.
The patch was tested by Kaz on sh4-linux. I've added the testcase and briefly checked it with make all and make -k check RUNTESTFLAGS="compile.exp=pr67506.c --target_board=sh-sim \{-m2/-ml,-m2/-mb,-m2a/-mb,-m4/-ml,-m4/-mb,-m4a/-ml,-m4a/-mb}" on trunk and gcc-5 branch. Cheers, Oleg gcc/ChangeLog PR target/67506 * config/sh/sh.c (sh_extending_set_of_reg::use_as_extended_reg): Add missing simplify_gen_subreg. gcc/testsuite/ChangeLog PR target/67506 * gcc.c-torture/compile/pr67506.c: New test.
Index: gcc/config/sh/sh.c =================================================================== --- gcc/config/sh/sh.c (revision 227639) +++ gcc/config/sh/sh.c (working copy) @@ -14016,6 +14016,9 @@ else { rtx extension_dst = XEXP (set_rtx, 0); + if (GET_MODE (extension_dst) != SImode) + extension_dst = simplify_gen_subreg (SImode, extension_dst, + GET_MODE (extension_dst), 0); if (modified_between_p (extension_dst, insn, use_at_insn)) { if (dump_file) Index: gcc/testsuite/gcc.c-torture/compile/pr67506.c =================================================================== --- gcc/testsuite/gcc.c-torture/compile/pr67506.c (revision 0) +++ gcc/testsuite/gcc.c-torture/compile/pr67506.c (working copy) @@ -0,0 +1,53 @@ +extern struct _IO_FILE *stderr; +typedef long integer; +typedef unsigned char byte; +short nl; +byte * tfmfilearray; +integer charbase, ligkernbase; +unsigned char charsonline; +short c; +unsigned short r; +struct { + short cc; + integer rr; +} labeltable[259]; +short sortptr; +unsigned char activity[(32510) + 1]; +integer ai, acti; +extern void _IO_putc (char, struct _IO_FILE *); + +void +mainbody (void) +{ + register integer for_end; + if (c <= for_end) + do { + if (((tfmfilearray + 1001)[4 * (charbase + c) + 2] % 4) == 1) + { + if ( r < nl ) + ; + else + { + while (labeltable[sortptr ].rr > r) + labeltable[sortptr + 1 ]= labeltable[sortptr]; + } + } + } while (c++ < for_end); + + if (ai <= for_end) + do { + if (activity[ai]== 2) + { + r = (tfmfilearray + 1001)[4 * (ligkernbase + (ai))]; + if (r < 128) + { + r = r + ai + 1 ; + if (r >= nl) + { + if (charsonline > 0) + _IO_putc ('\n', stderr); + } + } + } + } while (ai++ < for_end); +}