This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


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);


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]