[Bug tree-optimization/79334] Segfault on tree loop hoisting

rguenth at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Thu Feb 2 12:38:00 GMT 2017


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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |wrong-code
             Status|NEW                         |ASSIGNED
           Assignee|unassigned at gcc dot gnu.org      |rguenth at gcc dot gnu.org

--- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> ---
So we don't do the hoisting for

int d[][8];
extern void func_that_exits (int);

int
main (void)
{
  int e;
  while (1)
    {
      func_that_exits (e);
      e = d[1000][0];
    }
  return 0;
}

which is because func_that_exits may clobber it which it can't if d is
static readonly.  So we hoist it for

const int d[8];
extern void func_that_exits (int);

int
main (void)
{
  int e;
  while (1)
    {
      func_that_exits (e);
      e = d[10];
    }
  return 0;
}

Mine.


More information about the Gcc-bugs mailing list