[Bug fortran/86830] [8/9 Regression] Contiguous array pointer function result not recognized as contiguous

2018-09-18 Thread janus at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86830

janus at gcc dot gnu.org changed:

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
 Resolution|--- |FIXED

--- Comment #7 from janus at gcc dot gnu.org ---
Fixed on 9-trunk and 8-branch. Closing. Thanks for the report!

[Bug fortran/86830] [8/9 Regression] Contiguous array pointer function result not recognized as contiguous

2018-09-18 Thread janus at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86830

--- Comment #6 from janus at gcc dot gnu.org ---
Author: janus
Date: Tue Sep 18 19:16:24 2018
New Revision: 264407

URL: https://gcc.gnu.org/viewcvs?rev=264407=gcc=rev
Log:
2018-09-18  Janus Weil  

Backport from trunk
PR fortran/86830
* expr.c (gfc_is_simply_contiguous): Handle type-bound procedure calls
with non-polymorphic objects.

2018-09-18  Janus Weil  

Backport from trunk
PR fortran/86830
* gfortran.dg/typebound_call_30.f90: New test case.

Added:
branches/gcc-8-branch/gcc/testsuite/gfortran.dg/typebound_call_30.f90
Modified:
branches/gcc-8-branch/gcc/fortran/ChangeLog
branches/gcc-8-branch/gcc/fortran/expr.c
branches/gcc-8-branch/gcc/testsuite/ChangeLog

[Bug fortran/86830] [8/9 Regression] Contiguous array pointer function result not recognized as contiguous

2018-09-11 Thread janus at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86830

--- Comment #5 from janus at gcc dot gnu.org ---
Author: janus
Date: Tue Sep 11 06:33:39 2018
New Revision: 264201

URL: https://gcc.gnu.org/viewcvs?rev=264201=gcc=rev
Log:
fix PR 86830

2018-09-11  Janus Weil  

PR fortran/86830
* expr.c (gfc_is_simply_contiguous): Handle type-bound procedure calls
with non-polymorphic objects.

2018-09-11  Janus Weil  

PR fortran/86830
* gfortran.dg/typebound_call_30.f90: New test case.

Added:
trunk/gcc/testsuite/gfortran.dg/typebound_call_30.f90
Modified:
trunk/gcc/fortran/ChangeLog
trunk/gcc/fortran/expr.c
trunk/gcc/testsuite/ChangeLog

[Bug fortran/86830] [8/9 Regression] Contiguous array pointer function result not recognized as contiguous

2018-09-08 Thread janus at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86830

--- Comment #4 from janus at gcc dot gnu.org ---
(In reply to janus from comment #2)
> This draft patch fixes the problem:

... and regtests cleanly.

[Bug fortran/86830] [8/9 Regression] Contiguous array pointer function result not recognized as contiguous

2018-09-08 Thread janus at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86830

janus at gcc dot gnu.org changed:

   What|Removed |Added

   See Also||https://gcc.gnu.org/bugzill
   ||a/show_bug.cgi?id=83012

--- Comment #3 from janus at gcc dot gnu.org ---
It seems the regressions was introduced by r254914, see PR 83012.

[Bug fortran/86830] [8/9 Regression] Contiguous array pointer function result not recognized as contiguous

2018-09-08 Thread janus at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86830

janus at gcc dot gnu.org changed:

   What|Removed |Added

 Status|NEW |ASSIGNED
   Assignee|unassigned at gcc dot gnu.org  |janus at gcc dot gnu.org
   Target Milestone|--- |8.3

--- Comment #2 from janus at gcc dot gnu.org ---
This draft patch fixes the problem:


diff --git a/gcc/fortran/expr.c b/gcc/fortran/expr.c
index c5bf822cd24..43a37018575 100644
--- a/gcc/fortran/expr.c
+++ b/gcc/fortran/expr.c
@@ -5390,7 +5390,7 @@ gfc_is_simply_contiguous (gfc_expr *expr, bool strict,
bool permit_element)
  gfc_ref *r, *rc;

  s = expr->symtree->n.sym;
- if (s->ts.type != BT_CLASS)
+ if (s->ts.type != BT_CLASS && s->ts.type != BT_DERIVED)
return false;

  rc = NULL;

[Bug fortran/86830] [8/9 Regression] Contiguous array pointer function result not recognized as contiguous

2018-09-06 Thread janus at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86830

janus at gcc dot gnu.org changed:

   What|Removed |Added

   Keywords||rejects-valid
 Status|UNCONFIRMED |NEW
   Last reconfirmed||2018-09-06
 CC||janus at gcc dot gnu.org
Summary|Contiguous array pointer|[8/9 Regression] Contiguous
   |function result not |array pointer function
   |recognized as contiguous|result not recognized as
   ||contiguous
 Ever confirmed|0   |1

--- Comment #1 from janus at gcc dot gnu.org ---
I can confirm the error with gfortran 8 and trunk, but I don't see it with
7.3.0 and earlier. Seems to be a regression. Slightly reduced test case:


module m
  implicit none

  type :: t1
   contains
 procedure :: get_ptr
  end type

  type :: t2
 class(t1), allocatable :: c
  end type

contains
  function get_ptr(this)
class(t1) :: this
real, dimension(:), contiguous, pointer :: get_ptr
  end function

  subroutine test()
real, dimension(:), contiguous, pointer:: ptr
type(t2) :: x
ptr => x%c%get_ptr()
  end subroutine

end module