https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83567
Paul Thomas <pault at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEW Last reconfirmed| |2017-12-24 Assignee|unassigned at gcc dot gnu.org |pault at gcc dot gnu.org Ever confirmed|0 |1 --- Comment #1 from Paul Thomas <pault at gcc dot gnu.org> --- Confirmed. Many thanks for the report. The tree dump of addw shows what the problem is: addvv (struct Pdtvec & restrict a, struct Pdtvec & restrict b) { integer(kind=8) D.3776; void * restrict D.3777; struct Pdtvec c; try { c.k = 3; c.k = a->k; c.foo.dim[0].lbound = 1; c.foo.dim[0].ubound = (integer(kind=8)) a->k; c.foo.dim[0].stride = 1; c.foo.offset = -1; D.3776 = (integer(kind=8)) a->k * 4; D.3777 = (void * restrict) __builtin_malloc (MAX_EXPR <(unsigned long) D.3776, 1>); c.foo.data = D.3777; c.foo.dtype = 265; { ...snip... } return c; } finally { if ((integer(kind=4)[0:] * restrict) c.foo.data != 0B) { __builtin_free ((void *) c.foo.data); } c.foo.data = 0B; } } c%foo is being initialized correctly but is being freed on exit from the function. I will post the fix as soon as the regression testing is complete. Paul