From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 301 invoked by alias); 13 Jun 2010 21:38:45 -0000 Received: (qmail 32747 invoked by uid 48); 13 Jun 2010 21:38:35 -0000 Date: Sun, 13 Jun 2010 21:38:00 -0000 Message-ID: <20100613213835.32746.qmail@sourceware.org> X-Bugzilla-Reason: CC References: Subject: [Bug fortran/44529] [F03] array allocation with SOURCE In-Reply-To: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "janus at gcc dot gnu dot org" Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2010-06/txt/msg01498.txt.bz2 ------- 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