[Bug rtl-optimization/64291] New: [5 Regression] Miscompile t-div in GMP's testsuite
glisse at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Fri Dec 12 17:41:00 GMT 2014
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64291
Bug ID: 64291
Summary: [5 Regression] Miscompile t-div in GMP's testsuite
Product: gcc
Version: 5.0
Status: UNCONFIRMED
Keywords: wrong-code
Severity: normal
Priority: P3
Component: rtl-optimization
Assignee: unassigned at gcc dot gnu.org
Reporter: glisse at gcc dot gnu.org
In the following code, on x86_64-unknown-linux-gnu, we should call g(0,8,16),
but we somehow end up calling g(0,16,16). The most suspicious dump is
marc.c.228r.postreload.
$ gcc-4.9 -O2 marc.c f.c && ./a.out
$ gcc-5 -O2 marc.c f.c && ./a.out
a.out: f.c:3: g: Assertion `a==8' failed.
zsh: abort ./a.out
$ cat f.c
#include <assert.h>
void f(void*p,...){}
void g(void*p,long a,long b){assert(a==8);}
$ cat marc.c
void f(void*,...);
void g(void*,long,long);
int nnn=0;
long test=0;
typedef struct
{
int _mp_size;
unsigned long *_mp_d;
} __mpz_struct;
typedef __mpz_struct mpz_t[1];
int main ()
{
mpz_t n, d;
long nn, dn;
unsigned long *np, *dup, *dnp, *qp;
long alloc, itch;
f (n);
f (d);
qp = (unsigned long*)__builtin_alloca(4099*8) + 1;
dnp = (unsigned long*)__builtin_alloca (2049*8);
alloc = 1;
for (test = 0; test < 1; test++)
{
dn = d->_mp_size;
dup = d->_mp_d;
f (dnp, dup, dn);
dnp[dn - 1] |= 1UL<<63;
f (0);
nn = nnn;
np = n->_mp_d;
qp[-1] = -757136820;
qp[nn - dn + 1] = 14883681;
f (0);
if (dn >= 6)
f (0);
itch = nn + 1;
if (itch + 1> alloc)
{
g(0,alloc*8,(itch+1)*8);
alloc = itch + 1;
}
f (np, nn);
}
return 0;
}
More information about the Gcc-bugs
mailing list