[Bug fortran/56849] Missing compile-time shape check for RESHAPE assignments with an ORDER= attribute

burnus at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Fri Apr 5 20:38:00 GMT 2013


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

--- Comment #4 from Tobias Burnus <burnus at gcc dot gnu.org> 2013-04-05 20:38:05 UTC ---
Seems as if someone missed the purpose of ORDER=, which doesn't affect the
shape:

print *, shape (reshape([1,2,3,4,5,6], [2,3], order=[1,2]))
print *, shape (reshape([1,2,3,4,5,6], [2,3], order=[2,1]))
print *, reshape([1,2,3,4,5,6], [2,3], order=[1,2])
print *, reshape([1,2,3,4,5,6], [2,3], order=[2,1])
end

prints:
 2 3
 2 3
 1 2 3 4 5 6
 1 4 2 5 3 6


>From gfc_resolve_reshape. The "order == NULL" check is wrong:

  /* TODO: Make this work with a constant ORDER parameter.  */
  if (shape->expr_type == EXPR_ARRAY
      && gfc_is_constant_expr (shape)
      && order == NULL)
    {
      gfc_constructor *c;
      f->shape = gfc_get_shape (f->rank);



More information about the Gcc-bugs mailing list