http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56451
Bug #: 56451
Summary: [4.8 regression] Wrong code for
gcc.c-torture/execute/941015-1.c on SH
Classification: Unclassified
Product: gcc
Version: 4.8.0
Status: UNCONFIRMED
Keywords: wrong-code
Severity: normal
Priority: P3
Component: rtl-optimization
AssignedTo: [email protected]
ReportedBy: [email protected]
Target: sh*-*-*
On sh4-linux, the function foo1 of gcc.c-torture/execute/941015-1.c
int
foo1 (value)
long long value;
{
register const long long constant = 0xc000000080000000LL;
if (value < constant)
return 1;
else
return 2;
}
is assembled to a wrong code with -O1
foo1:
mov.l .L7,r1
cmp/gt r1,r5
bt/s .L10
mov #2,r0
cmp/ge r1,r5
bf/s .L10
mov #1,r0
.L10:
rts
nop
.L9:
.align 2
.L7:
.long -1073741824
It looks delayed branch optimization causes this.