This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH][PING] Fix PR19807 and PR19639


This fixes PR19807 and PR19639 and type safeness of
try_move_mult_to_index.  It basically combines and refines the
two patches posted at
http://gcc.gnu.org/ml/gcc-patches/2005-04/msg02592.html
and
http://gcc.gnu.org/ml/gcc-patches/2005-04/msg02961.html

Before we folded only &a[i] + cst * j to &a[i+j] if cst == step
of the array.  Now we handle the cases &a[i] + cst and &a[i] + j,
too.  The array index type is now always casted to TYPE_DOMAIN
of the array, if available, and we bail out, if not.

This causes a bootstrap failure in c-format.c in that fold_stmt
now produces &a[(cast)i], which is not gimple.  Fixed by the
set_rhs change.  It also causes an ICE for
gcc.c-torture/execute/20031215-1.c because fold_indirect_ref_1
is bogous (Jeff promised to fix it).

We now expose the loop created for the initializer of

struct Foo { ~Foo() {} int i; };
struct NonPod { Foo foo[2]; };
void foo(void)
{
        NonPod x;
}

to the optimizers, producing

void foo() ()
{
  unsigned int ivtmp.1;
  struct Foo * pretmp.0;
  struct Foo * const this;
  register struct Foo * D.1739;
  struct Foo[2] * D.1738;
  struct NonPod x;

<bb 0>:

<L6>:;
  return;

}

for -O2 -fpeel-loops instead of

void foo() ()
{
  void * ivtmp.3;
  struct Foo * const this;
  register struct Foo * D.1739;
  struct Foo[2] * D.1738;
  struct NonPod x;

<bb 0>:
  ivtmp.3 = &x.foo[2];

<L2>:;
  ivtmp.3 = ivtmp.3 - 4B;
  if (ivtmp.3 == &x.foo) goto <L6>; else goto <L2>;

<L6>:;
  return;

}

Bootstrapped and tested on x86_64-unknown-linux-gnu.

Ok for mainline?

Thanks,
Richard.

Attachment: fix-pr19807-4
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]