http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52573
Bug #: 52573
Summary: [4.5/4.6/4.7/4.8 regression] regrename creates
overlapping register allocations for output operands
Classification: Unclassified
Product: gcc
Version: 4.8.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: rtl-optimization
AssignedTo: [email protected]
ReportedBy: [email protected]
Target: m86k-*
gcc.c-torture/execute/20040709-1.c when compiled with -O3 -funroll-loops (which
enables -frename-registers) generates:
muls.l #-2004318071,%d1:%d1
which produces undefined results. regrename transforms
(insn 118 200 119 7 (parallel [
(set (reg:SI 1 %d1 [235])
(truncate:SI (lshiftrt:DI (mult:DI (sign_extend:DI (reg:SI 3
%d3 [236]))
(const_int -2004318071 [0x88888889]))
(const_int 32 [0x20]))))
(clobber (reg:SI 3 %d3 [236]))
]) ../gcc/gcc/testsuite/gcc.c-torture/execute/20040709-1.c:91 192
{const_smulsi3_highpart}
(expr_list:REG_DEAD (reg:SI 3 %d3 [236])
(expr_list:REG_UNUSED (reg:SI 3 %d3 [236])
(nil))))
into
(insn 118 200 119 7 (parallel [
(set (reg:SI 1 %d1 [235])
(truncate:SI (lshiftrt:DI (mult:DI (sign_extend:DI (reg:SI 1
%d1 [236]))
(const_int -2004318071 [0x88888889]))
(const_int 32 [0x20]))))
(clobber (reg:SI 1 %d1 [236]))
]) ../gcc/gcc/testsuite/gcc.c-torture/execute/20040709-1.c:91 192
{const_smulsi3_highpart}
(expr_list:REG_DEAD (reg:SI 3 %d3 [236])
(expr_list:REG_UNUSED (reg:SI 3 %d3 [236])
(nil))))
The simplified testcase:
int mod (int a) { return a % 15; }
reproduces the bug with 4.5 and 4.6, though not with 4.7/4.8.