This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
target/8213: gmp 4.1 miscompilation on x86-64
- From: gbeauchesne at mandrakesoft dot com
- To: gcc-gnats at gcc dot gnu dot org
- Cc: aj at suse dot de, jh at suse dot cz
- Date: 13 Oct 2002 19:43:17 -0000
- Subject: target/8213: gmp 4.1 miscompilation on x86-64
- Reply-to: gbeauchesne at mandrakesoft dot com
>Number: 8213
>Category: target
>Synopsis: gmp 4.1 miscompilation on x86-64
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: unassigned
>State: open
>Class: wrong-code
>Submitter-Id: net
>Arrival-Date: Sun Oct 13 12:46:01 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator: Gwenole Beauchesne
>Release: GNU C version 3.3 20020916 (experimental)
>Organization:
>Environment:
x86_64-mandrake-linux-gnu
>Description:
gcc-3.2 snapshots older than 2002-10-07 or earlier used to miscompile gmp 4.1 on x86-64. Reproduced with gcc3.3 2002-09-16, though it did not fully bootstrap (comparison failures in stage3) but that's not related.
>How-To-Repeat:
Compile the following testcase with -O2, extracted from <gmp>/mpf/cmp_si.c:
int f(long x, long y)
{
if ((x < 0) == (y < 0))
{
if (x == 0)
return -(y != 0);
if (y == 0)
return x != 0;
}
else
{
return x >= 0 ? 1 : -1;
}
}
int main(void)
{
if (f(-1, 1) != -1)
abort();
return 0;
}
>Fix:
- Add -fno-cse-follow-jumps (Andreas' hint) or lower optimizations to -O1.
- Note that s/long x/int x/ also workarounds the problem.
Does someone know which patch fixed this problem? If so, would someone mind commit it to the regression testsuite?
>Release-Note:
>Audit-Trail:
>Unformatted: