This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug target/35264] New: [4.3 regression] ntfs-3g miscompiled
- From: "matz at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 20 Feb 2008 16:21:41 -0000
- Subject: [Bug target/35264] New: [4.3 regression] ntfs-3g miscompiled
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
This testcase, compiled with -O1 aborts:
% cat t.c
extern void abort(void);
long long __attribute__((noinline)) get(void)
{
return -2;
}
long long __attribute__((noinline)) get(void);
int __attribute__((noinline)) check(void)
{
long long lcn;
lcn = get();
if (lcn >= 0 || lcn == -1)
return 0;
return -1;
}
int main()
{
if (check() == 0)
abort();
return 0;
}
Reason is ix86_expand_branch, the committ for PR target/29978 misses breaks
in the switch statement, hence falls through into the wrong branch.
Obvious patch:
Index: config/i386/i386.c
===================================================================
--- config/i386/i386.c (revision 132470)
+++ config/i386/i386.c (working copy)
@@ -12148,6 +12152,7 @@ ix86_expand_branch (enum rtx_code code,
ix86_expand_branch (code, label);
return;
}
+ break;
case LE: case LEU: case GT: case GTU:
if (lo[1] == constm1_rtx)
{
@@ -12156,6 +12161,7 @@ ix86_expand_branch (enum rtx_code code,
ix86_expand_branch (code, label);
return;
}
+ break;
default:
break;
}
Richi already preapproved this patch for 4.3, I'm opening this PR anyway, to
have a reference for the testcase.
--
Summary: [4.3 regression] ntfs-3g miscompiled
Product: gcc
Version: 4.3.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: target
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: matz at gcc dot gnu dot org
GCC target triplet: i386
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35264