re PR fortran/58916 ([F03] Allocation of scalar with array source not rejected)
2013-12-11 Janus Weil <janus@gcc.gnu.org> PR fortran/58916 * resolve.c (conformable_arrays): Treat scalar 'e2'. (resolve_allocate_expr): Check rank also for unlimited-polymorphic variables. 2013-12-11 Janus Weil <janus@gcc.gnu.org> PR fortran/58916 * gfortran.dg/allocate_with_source_4.f90: New. From-SVN: r205894
This commit is contained in:
parent
eaf4967a9d
commit
2ccd6f7276
|
@ -1,3 +1,10 @@
|
|||
2013-12-11 Janus Weil <janus@gcc.gnu.org>
|
||||
|
||||
PR fortran/58916
|
||||
* resolve.c (conformable_arrays): Treat scalar 'e2'.
|
||||
(resolve_allocate_expr): Check rank also for unlimited-polymorphic
|
||||
variables.
|
||||
|
||||
2013-12-10 Janus Weil <janus@gcc.gnu.org>
|
||||
|
||||
PR fortran/35831
|
||||
|
|
|
@ -6597,7 +6597,8 @@ conformable_arrays (gfc_expr *e1, gfc_expr *e2)
|
|||
for (tail = e2->ref; tail && tail->next; tail = tail->next);
|
||||
|
||||
/* First compare rank. */
|
||||
if (tail && e1->rank != tail->u.ar.as->rank)
|
||||
if ((tail && e1->rank != tail->u.ar.as->rank)
|
||||
|| (!tail && e1->rank != e2->rank))
|
||||
{
|
||||
gfc_error ("Source-expr at %L must be scalar or have the "
|
||||
"same rank as the allocate-object at %L",
|
||||
|
@ -6794,8 +6795,7 @@ resolve_allocate_expr (gfc_expr *e, gfc_code *code)
|
|||
}
|
||||
|
||||
/* Check F03:C632 and restriction following Note 6.18. */
|
||||
if (code->expr3->rank > 0 && !unlimited
|
||||
&& !conformable_arrays (code->expr3, e))
|
||||
if (code->expr3->rank > 0 && !conformable_arrays (code->expr3, e))
|
||||
goto failure;
|
||||
|
||||
/* Check F03:C633. */
|
||||
|
|
|
@ -1,3 +1,8 @@
|
|||
2013-12-11 Janus Weil <janus@gcc.gnu.org>
|
||||
|
||||
PR fortran/58916
|
||||
* gfortran.dg/allocate_with_source_4.f90: New.
|
||||
|
||||
2013-12-11 Jakub Jelinek <jakub@redhat.com>
|
||||
|
||||
PR tree-optimization/59417
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
! { dg-do compile }
|
||||
!
|
||||
! PR 58916: [F03] Allocation of scalar with array source not rejected
|
||||
!
|
||||
! Contributed by Vladimir Fuka <vladimir.fuka@gmail.com>
|
||||
|
||||
class(*), allocatable :: a1
|
||||
real, allocatable :: a2
|
||||
real b(1)
|
||||
allocate(a1, source=b) ! { dg-error "must be scalar or have the same rank" }
|
||||
allocate(a2, source=b) ! { dg-error "must be scalar or have the same rank" }
|
||||
end
|
Loading…
Reference in New Issue