https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99308
Tobias Burnus <burnus at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |missed-optimization CC| |burnus at gcc dot gnu.org --- Comment #2 from Tobias Burnus <burnus at gcc dot gnu.org> --- I think there are two errors: (a) The value can be simplified at compile time as the size (8 or 2) is known at compile time, but isn't. I wonder whether this only a problem for 'size' or also for 'ubound','lbound' or when doing var(:)%idx = 0 – for the bounds of the generated do loop. (b) The run-time version is wrong. In my dump, (and output '2 2') I see for either variable parm.10.span = spcs->_vptr->_size; parm.10.dtype = {.elem_len=4, .rank=1, .type=5}; D.3995 = stride.5; parm.10.dim[0].lbound = 1; parm.10.dim[0].ubound = 2; parm.10.dim[0].stride = NON_LVALUE_EXPR <D.3995>; parm.10.data = 0B; parm.10.offset = -NON_LVALUE_EXPR <D.3995>; D.3996 = &parm.10; D.3997 = (integer(kind=4)) MAX_EXPR <(D.3996->dim[0].ubound - D.3996->dim[0].lbound) + 1, 0>; Obviously, 'ubound = 2' is only valid for 'fuel' and not for 'spcs'.