From patchwork Sat Jan 22 18:03:52 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Tobias Burnus X-Patchwork-Id: 80012 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 E5ADDB710D for ; Sun, 23 Jan 2011 05:04:13 +1100 (EST) Received: (qmail 31222 invoked by alias); 22 Jan 2011 18:04:12 -0000 Received: (qmail 31207 invoked by uid 22791); 22 Jan 2011 18:04:10 -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; Sat, 22 Jan 2011 18:03:56 +0000 Received: from [192.168.178.22] (port-92-204-33-159.dynamic.qsc.de [92.204.33.159]) by mx01.qsc.de (Postfix) with ESMTP id 623F03D231; Sat, 22 Jan 2011 19:03:53 +0100 (CET) Message-ID: <4D3B1C08.2050709@net-b.de> Date: Sat, 22 Jan 2011 19:03:52 +0100 From: Tobias Burnus User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; de; rv:1.9.2.13) Gecko/20101206 SUSE/3.1.7 Thunderbird/3.1.7 MIME-Version: 1.0 To: Thomas Koenig CC: Jerry DeLisle , "fortran@gcc.gnu.org" , gcc-patches Subject: Re: [patch, fortran] Fix PR 38536 References: <4D317249.30509@netcologne.de> <4D317C83.1020804@net-b.de> <4D322381.5050000@netcologne.de> <4D3AE6AA.8060108@frontier.com> <4D3B14F2.6050008@netcologne.de> In-Reply-To: <4D3B14F2.6050008@netcologne.de> 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 On 01/15/2011 02:45 PM, Thomas Koenig wrote: >>> here is an update of the patch. This one just warns about array >>> sections if they are followed by component references. s/warns/prints an error/ > Revision 169130 übertragen. How about the following patch on top of it? I think the crucial part (for F2008 at least) is rather the contiguity. The patch looks longer than it is due to white space changes. Tobias diff --git a/gcc/fortran/resolve.c b/gcc/fortran/resolve.c index 9f0d675..f458cbe 100644 --- a/gcc/fortran/resolve.c +++ b/gcc/fortran/resolve.c @@ -2700,7 +2700,6 @@ gfc_iso_c_func_interface (gfc_symbol *sym, gfc_actual_arglist *args, else if (sym->intmod_sym_id == ISOCBINDING_LOC) { gfc_ref *ref; - bool seen_section; /* Make sure we have either the target or pointer attribute. */ if (!arg_attr.target && !arg_attr.pointer) @@ -2722,35 +2721,29 @@ gfc_iso_c_func_interface (gfc_symbol *sym, gfc_actual_arglist *args, /* Follow references to make sure there are no array sections. */ - seen_section = false; for (ref=args->expr->ref; ref; ref = ref->next) { if (ref->type == REF_ARRAY) - { - if (ref->u.ar.type == AR_SECTION) - seen_section = true; - - if (ref->u.ar.type != AR_ELEMENT) - { - gfc_ref *r; - for (r = ref->next; r; r=r->next) - if (r->type == REF_COMPONENT) - { + if (ref->u.ar.type != AR_ELEMENT) + { + gfc_ref *r; + for (r = ref->next; r; r=r->next) + if (r->type == REF_COMPONENT) + { gfc_error_now ("Array section not permitted" " in '%s' call at %L", name, &(args->expr->where)); retval = FAILURE; break; - } - } - } + } + } } - if (seen_section && retval == SUCCESS) - gfc_warning ("Array section in '%s' call at %L", name, + if (retval == SUCCESS && gfc_is_simply_contiguous (args->expr, false)) + gfc_warning ("Array might be not contiguous in '%s' call at %L", name, &(args->expr->where)); - + /* See if we have interoperable type and type param. */ if (verify_c_interop (arg_ts) == SUCCESS || gfc_check_any_c_kind (arg_ts) == SUCCESS)