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/44529] [F03] array allocation with SOURCE



------- Comment #1 from janus at gcc dot gnu dot org  2010-06-13 21:38 -------
(In reply to comment #0)
> First example:
> 
> 
> integer, allocatable :: a(:), b(:)
> allocate (a, source = b)
> end
> 
> 
> This is rejected with
> 
> allocate (a, source = b)
>           1
> Error: Array specification required in ALLOCATE statement at (1)
> 
> although it is valid (cf. F08:C633).

The error message is fixed with this patch:

Index: gcc/fortran/resolve.c
===================================================================
--- gcc/fortran/resolve.c       (revision 160678)
+++ gcc/fortran/resolve.c       (working copy)
@@ -6449,10 +6449,10 @@ resolve_allocate_expr (gfc_expr *e, gfc_code *code
   if (pointer || (dimension == 0 && codimension == 0))
     goto success;

-  /* Make sure the next-to-last reference node is an array specification.  */
-
-  if (ref2 == NULL || ref2->type != REF_ARRAY || ref2->u.ar.type == AR_FULL
-      || (dimension && ref2->u.ar.dimen == 0))
+  /* F08:C633.  */
+  if (!code->expr3
+      && (ref2 == NULL || ref2->type != REF_ARRAY || ref2->u.ar.type ==
AR_FULL
+         || (dimension && ref2->u.ar.dimen == 0)))
     {
       gfc_error ("Array specification required in ALLOCATE statement "
                 "at %L", &e->where);


But then this test case also ICEs:

c0a.f90:2:0: internal compiler error: in gfc_array_allocate, at
fortran/trans-array.c:4056


-- 


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


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