http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60647

--- Comment #6 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Note the reduced testcase has implicit types, while that isn't necessary to
reproduce this:
struct _wincore
{
  int width, height;
};

static void
foo (dpy, winInfo, offset)
     void *dpy;
     struct _wincore *winInfo;
     int offset;
{
  fn1 (winInfo->height);
}

static void
bar (dpy, winInfo, visrgn)
     void *dpy;
     int winInfo;
     int *visrgn;
{
  foo ((void *) 0, winInfo, 0);
  fn2 (0, 0, visrgn);
}

void
baz (dpy, win, prop)
     void *dpy;
     int win;
     int prop;
{
  bar ((void *) 0, 0, (int *) 0);
}

ICEs in the same spot and:
struct _wincore
{
  int width, height;
};

static void
foo (dpy, winInfo, offset)
     void *dpy;
     struct _wincore *winInfo;
     int offset;
{
  fn1 (winInfo->height);
}

static void
bar (dpy, winInfo, visrgn)
     void *dpy;
     int winInfo;
     int *visrgn;
{
  foo ((void *) 0, winInfo, 0);
  fn2 (visrgn);
}

void
baz (dpy, win, prop)
     void *dpy;
     int win;
     int prop;
{
  bar ((void *) 0, 0, (int *) 0);
}

ICEs during expansion.  And yes, I think IPA-SRA should give up in these cases.

Note even the original testcase looks wrong, there is:
typedef unsigned long XID;
typedef XID Window;
static Region
GetWindowRegion(dpy, winInfo, offset)
    Display *dpy;
    WinGeneric *winInfo;
    int offset;
{
    return MakeRegionFromRect(
 offset ? winInfo->core.x : 0,
 offset ? winInfo->core.y : 0,
 winInfo->core.width,
 winInfo->core.height
    );
}
static void
SubtractWindowFromVisibleRegion(dpy, winInfo, visrgn)
    Display *dpy;
    Window winInfo;
    Region visrgn;
{
    Region winrgn = GetWindowRegion(dpy, winInfo, 1);
    XSubtractRegion(visrgn, winrgn, visrgn);
    XDestroyRegion(winrgn);
}
So, GetWindowRegion is called with unsigned long that is passed to a function
expecting a structure pointer.

Reply via email to