[Bug testsuite/64427] gcc.target/i386/pr64291-1.c is invalid

hjl.tools at gmail dot com gcc-bugzilla@gcc.gnu.org
Sun Dec 28 18:59:00 GMT 2014


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64427

--- Comment #3 from H.J. Lu <hjl.tools at gmail dot com> ---
(In reply to Marc Glisse from comment #2)
> Restricting the testcase to x86_64 would be fine with me.
> 
> As far as main is concerned, f could have written in n and d. The
> uninitialized values are only passed around, it doesn't seem relevant.

There are

  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;
          ^^^^^^^^^^
"dn" here contains some random value, which may be > size of dnp and
program may crash which happens with -m32 for me.



More information about the Gcc-bugs mailing list