* [Patch, Fortran] PR51953 - allow multiple alloc obj. with SOURCE= in allocate
@ 2012-01-27 6:57 Tobias Burnus
2012-01-27 12:15 ` Paul Richard Thomas
0 siblings, 1 reply; 2+ messages in thread
From: Tobias Burnus @ 2012-01-27 6:57 UTC (permalink / raw)
To: gcc patches, gfortran
[-- Attachment #1: Type: text/plain, Size: 95 bytes --]
That's a Fortran 2008 feature.
Build and regtested on x86-64-linux.
OK for the trunk?
Tobias
[-- Attachment #2: multi-source.diff --]
[-- Type: text/x-patch, Size: 2458 bytes --]
2012-01-27 Tobias Burnus <burnus@net-b.de>
PR fortran/51953
* match.c (gfc_match_allocate): Allow more than allocate
object with SOURCE=.
2012-01-27 Tobias Burnus <burnus@net-b.de>
PR fortran/51953
* gfortran.dg/allocate_alloc_opt_13.f90: New.
* gfortran.dg/allocate_alloc_opt_4.f90: Add -std=f2003
and change dg-error string.
Index: gcc/fortran/match.c
===================================================================
--- gcc/fortran/match.c (revision 183575)
+++ gcc/fortran/match.c (working copy)
@@ -3660,12 +3660,11 @@ alloc_opt_list:
goto cleanup;
}
- if (head->next)
- {
- gfc_error ("SOURCE tag at %L requires only a single entity in "
- "the allocation-list", &tmp->where);
- goto cleanup;
- }
+ if (head->next
+ && gfc_notify_std (GFC_STD_F2008, "Fortran 2008: SOURCE tag at %L"
+ " with more than a single allocate objects",
+ &tmp->where) == FAILURE)
+ goto cleanup;
source = tmp;
tmp = NULL;
Index: gcc/testsuite/gfortran.dg/allocate_alloc_opt_13.f90
===================================================================
--- gcc/testsuite/gfortran.dg/allocate_alloc_opt_13.f90 (revision 0)
+++ gcc/testsuite/gfortran.dg/allocate_alloc_opt_13.f90 (working copy)
@@ -0,0 +1,25 @@
+! { dg-do compile }
+!
+! PR fortran/51953
+!
+!
+type t
+end type t
+
+class(t), allocatable :: a, c(:), e(:)
+class(t), pointer :: b, d(:)
+
+allocate (a, b, source=c(1))
+allocate (c(4), d(6), source=e)
+
+allocate (a, b, source=f())
+allocate (c(1), d(6), source=g())
+
+contains
+function f()
+ class(t), allocatable :: f
+end function
+function g()
+ class(t), allocatable :: g(:)
+end function
+end
Index: gcc/testsuite/gfortran.dg/allocate_alloc_opt_4.f90
===================================================================
--- gcc/testsuite/gfortran.dg/allocate_alloc_opt_4.f90 (revision 183575)
+++ gcc/testsuite/gfortran.dg/allocate_alloc_opt_4.f90 (working copy)
@@ -1,4 +1,5 @@
! { dg-do compile }
+! { dg-options "-std=f2003" }
program a
implicit none
@@ -16,7 +17,7 @@ program a
allocate(integer(4) :: i(4), source=n) ! { dg-error "conflicts with the typespec" }
- allocate(i(4), j(n), source=n) ! { dg-error "requires only a single entity" }
+ allocate(i(4), j(n), source=n) ! { dg-error "Fortran 2008: SOURCE tag at .1. with more than a single allocate objects" }
allocate(x(4), source=n) ! { dg-error "type incompatible with" }
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [Patch, Fortran] PR51953 - allow multiple alloc obj. with SOURCE= in allocate
2012-01-27 6:57 [Patch, Fortran] PR51953 - allow multiple alloc obj. with SOURCE= in allocate Tobias Burnus
@ 2012-01-27 12:15 ` Paul Richard Thomas
0 siblings, 0 replies; 2+ messages in thread
From: Paul Richard Thomas @ 2012-01-27 12:15 UTC (permalink / raw)
To: Tobias Burnus; +Cc: gcc patches, gfortran
Dear Tobias,
This is 'obvious', barring the issue that I mentioned about multiple
evaluation of expressions that are not variabbles. That said, I think
that this could and should be committed now.
OK for trunk.
Cheers
Paul
On Fri, Jan 27, 2012 at 7:57 AM, Tobias Burnus <burnus@net-b.de> wrote:
> That's a Fortran 2008 feature.
>
> Build and regtested on x86-64-linux.
> OK for the trunk?
>
> Tobias
--
The knack of flying is learning how to throw yourself at the ground and miss.
--Hitchhikers Guide to the Galaxy
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2012-01-27 12:15 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-01-27 6:57 [Patch, Fortran] PR51953 - allow multiple alloc obj. with SOURCE= in allocate Tobias Burnus
2012-01-27 12:15 ` Paul Richard Thomas
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).