On Thu, Dec 18, 2014 at 12:52 PM, Vladimir Makarov <vmaka...@redhat.com> wrote:
>   The following patch solves
>
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64291
>
>   It is a bug in a new rematerialization subpass of LRA.
>
> The patch was bootstrapped on x86/x86-64.
>
> Committed as rev. 218874.
>
> 2014-12-18  Vladimir Makarov  <vmaka...@redhat.com>
>
>         PR rtl-optimization/64291
>         * lra-remat.c (bad_for_rematerialization_p): Add UNPSEC_VLOATILE.
>         (create_cands): Process only output reload insn with potential
>         cands.
>
> 2014-12-18  Vladimir Makarov  <vmaka...@redhat.com>
>
>         PR rtl-optimization/64291
>         * testsuite/gcc.target/i386/pr64291-[12].c: New tests.
>

There are a couple problems with the testcase:

1. It has

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;

For 32-bit targets, like -m32 and -mx32, GCC complains:

/export/gnu/import/git/gcc/gcc/testsuite/gcc.target/i386/pr64291-1.c:33:25:
warning: left shift count >= width of type [-Wshift-count-overflow]

2.  This program uses uninitialized stack variable n, d:

void f(void*p,...){}

The behavior of this testcase is totally undefined.


-- 
H.J.

Reply via email to