From patchwork Sun May 6 20:31:16 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Tobias Burnus X-Patchwork-Id: 157193 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id 4FF47B6FB9 for ; Mon, 7 May 2012 06:31:47 +1000 (EST) Comment: DKIM? See http://www.dkim.org DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=gcc.gnu.org; s=default; x=1336941109; h=Comment: DomainKey-Signature:Received:Received:Received:Received: Message-ID:Date:From:User-Agent:MIME-Version:To:Subject: Content-Type:Mailing-List:Precedence:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:Sender:Delivered-To; bh=QsJjVUE /0eDogcJPnqO+bEz4gIY=; b=cfJIb9aQzrqZ7C33JnsxmKG9pmJIjg4lmPkJ4HF 1h0UsasGsaEagIjKjSdqLRBp3VJvsumGvIg3/0GXezpHC0ZW+et8r5QVIXUVTSxz M3s0odZcqguJbOanDspNczdwizwAeAGWV+p2e2shyYiFqYDBonlhGTGsg+ezplNy DIP4= Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=default; d=gcc.gnu.org; h=Received:Received:X-SWARE-Spam-Status:X-Spam-Check-By:Received:Received:Message-ID:Date:From:User-Agent:MIME-Version:To:Subject:Content-Type:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=THrfs+tZwkVHlZc2vXFCqOcC8owGM49M35sCTkD6FxoOBzFTiwjlkpCe+0tDEa XDL8iz7E8fiPZTb4iujj6A8pMINzKdoje0LAgeF76Tt0RQm24qFFlAuwDTBPlvnA xM7JHdFyMCljCBYfwUq8EBceKKHVP3d3Ku+mpYpCQs+6Q=; Received: (qmail 12919 invoked by alias); 6 May 2012 20:31:43 -0000 Received: (qmail 12901 invoked by uid 22791); 6 May 2012 20:31:42 -0000 X-SWARE-Spam-Status: No, hits=-1.8 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_NONE X-Spam-Check-By: sourceware.org Received: from mx01.qsc.de (HELO mx01.qsc.de) (213.148.129.14) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sun, 06 May 2012 20:31:19 +0000 Received: from [192.168.178.22] (port-92-204-82-207.dynamic.qsc.de [92.204.82.207]) by mx01.qsc.de (Postfix) with ESMTP id 9BE063CAD8; Sun, 6 May 2012 22:31:16 +0200 (CEST) Message-ID: <4FA6DF94.9060002@net-b.de> Date: Sun, 06 May 2012 22:31:16 +0200 From: Tobias Burnus User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:11.0) Gecko/20120328 Thunderbird/11.0.1 MIME-Version: 1.0 To: gcc patches , gfortran Subject: [Patch, Fortran, committed] PR41587 - fix diagnostic for pointer/alloc CLASS with non-derferred array spec Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Rather obvious after finding it … I first used "&& t != FAILURE"; however, that gives additional error messages of the form: class(t0), pointer :: foo(3) ! { dg-error "must have a deferred shape" } 1 Error: Component 'foo' with CLASS at (1) must be allocatable or pointer Thus, I decided to always call gfc_build_class_symbol. Committed (Rev. 187214) after building and regtesting it on x86-64-gnu-linux. Tobias 2012-05-06 Tobias Burnus PR fortran/41587 * decl.c (build_struct): Don't ignore FAILED status. 2012-05-06 Tobias Burnus PR fortran/41587 * gfortran.dg/class_array_13.f90: New. diff --git a/gcc/fortran/decl.c b/gcc/fortran/decl.c index 4da21c3..b527dd0 100644 --- a/gcc/fortran/decl.c +++ b/gcc/fortran/decl.c @@ -1653,17 +1653,20 @@ build_struct (const char *name, gfc_charlen *cl, gfc_expr **init, } scalar: if (c->ts.type == BT_CLASS) { bool delayed = (gfc_state_stack->sym == c->ts.u.derived) || (!c->ts.u.derived->components && !c->ts.u.derived->attr.zero_comp); - return gfc_build_class_symbol (&c->ts, &c->attr, &c->as, delayed); + gfc_try t2 = gfc_build_class_symbol (&c->ts, &c->attr, &c->as, delayed); + + if (t != FAILURE) + t = t2; } return t; } /* Match a 'NULL()', and possibly take care of some side effects. */ --- /dev/null 2012-05-04 18:48:20.115791170 +0200 +++ gcc/gcc/testsuite/gfortran.dg/class_array_13.f90 2012-05-06 18:48:31.000000000 +0200 @@ -0,0 +1,26 @@ +! { dg-do compile } +! { dg-options "-fcoarray=single" } +! +! PR fortran/41587 +! + +type t0 + integer :: j = 42 +end type t0 + +type t + integer :: i + class(t0), allocatable :: foo(3) ! { dg-error "must have a deferred shape" } +end type t + +type t2 + integer :: i + class(t0), pointer :: foo(3) ! { dg-error "must have a deferred shape" } +end type t2 + +type t3 + integer :: i + class(t0), allocatable :: foo[3] ! { dg-error "Upper bound of last coarray dimension must be '\\*'" } +end type t3 + +end