From patchwork Wed Dec 29 14:53:16 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Koenig X-Patchwork-Id: 76919 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 DF920B6EED for ; Thu, 30 Dec 2010 01:53:33 +1100 (EST) Received: (qmail 24957 invoked by alias); 29 Dec 2010 14:53:28 -0000 Received: (qmail 24940 invoked by uid 22791); 29 Dec 2010 14:53:26 -0000 X-SWARE-Spam-Status: No, hits=1.3 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_NONE, RCVD_IN_JMF_BL, T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from cc-smtpout2.netcologne.de (HELO cc-smtpout2.netcologne.de) (89.1.8.212) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 29 Dec 2010 14:53:20 +0000 Received: from cc-smtpin1.netcologne.de (cc-smtpin1.netcologne.de [89.1.8.201]) by cc-smtpout2.netcologne.de (Postfix) with ESMTP id BD33D1203E; Wed, 29 Dec 2010 15:53:17 +0100 (CET) Received: from [192.168.0.197] (xdsl-78-35-190-92.netcologne.de [78.35.190.92]) by cc-smtpin1.netcologne.de (Postfix) with ESMTPA id 93AAE11E8C; Wed, 29 Dec 2010 15:53:16 +0100 (CET) Subject: [patch, fortran, committed] Walk expressions in subroutine calls From: Thomas Koenig To: fortran@gcc.gnu.org Cc: gcc-patches@gcc.gnu.org Date: Wed, 29 Dec 2010 15:53:16 +0100 Message-ID: <1293634396.4756.33.camel@linux-fd1f.site> Mime-Version: 1.0 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 Hello world, I have committed the attached patch (rev. 168320) as obvious after regression-testing, after discovering that expressions in subroutine calls were not walked in frontend-passes.c. I also took the liberty of doing some whitespace fixes at the same time. Thomas 2010-12-29 Thomas Koenig * frontend-passes.c (gfc_code_walker): Handle expressions in EXEC_CALL, EXEC_ASSIGN_CALL and EXEC_CALL_PPC. Separate cases in switch statements by blank lines. 2010-12-29 Thomas Koenig * gfortran.dg/character_comparison_7.f90: New test. Index: frontend-passes.c =================================================================== --- frontend-passes.c (Revision 168201) +++ frontend-passes.c (Arbeitskopie) @@ -524,9 +524,12 @@ gfc_code_walker (gfc_code **c, walk_code_fn_t code int result = codefn (c, &walk_subtrees, data); if (result) return result; + if (walk_subtrees) { gfc_code *b; + gfc_actual_arglist *a; + switch ((*c)->op) { case EXEC_DO: @@ -535,6 +538,19 @@ gfc_code_walker (gfc_code **c, walk_code_fn_t code WALK_SUBEXPR ((*c)->ext.iterator->end); WALK_SUBEXPR ((*c)->ext.iterator->step); break; + + case EXEC_CALL: + case EXEC_ASSIGN_CALL: + for (a = (*c)->ext.actual; a; a = a->next) + WALK_SUBEXPR (a->expr); + break; + + case EXEC_CALL_PPC: + WALK_SUBEXPR ((*c)->expr1); + for (a = (*c)->ext.actual; a; a = a->next) + WALK_SUBEXPR (a->expr); + break; + case EXEC_SELECT: WALK_SUBEXPR ((*c)->expr1); for (b = (*c)->block; b; b = b->block) @@ -548,6 +564,7 @@ gfc_code_walker (gfc_code **c, walk_code_fn_t code WALK_SUBCODE (b->next); } continue; + case EXEC_ALLOCATE: case EXEC_DEALLOCATE: { @@ -556,6 +573,7 @@ gfc_code_walker (gfc_code **c, walk_code_fn_t code WALK_SUBEXPR (a->expr); break; } + case EXEC_FORALL: { gfc_forall_iterator *fa; @@ -568,6 +586,7 @@ gfc_code_walker (gfc_code **c, walk_code_fn_t code } break; } + case EXEC_OPEN: WALK_SUBEXPR ((*c)->ext.open->unit); WALK_SUBEXPR ((*c)->ext.open->file); @@ -591,12 +610,14 @@ gfc_code_walker (gfc_code **c, walk_code_fn_t code WALK_SUBEXPR ((*c)->ext.open->id); WALK_SUBEXPR ((*c)->ext.open->newunit); break; + case EXEC_CLOSE: WALK_SUBEXPR ((*c)->ext.close->unit); WALK_SUBEXPR ((*c)->ext.close->status); WALK_SUBEXPR ((*c)->ext.close->iostat); WALK_SUBEXPR ((*c)->ext.close->iomsg); break; + case EXEC_BACKSPACE: case EXEC_ENDFILE: case EXEC_REWIND: @@ -605,6 +626,7 @@ gfc_code_walker (gfc_code **c, walk_code_fn_t code WALK_SUBEXPR ((*c)->ext.filepos->iostat); WALK_SUBEXPR ((*c)->ext.filepos->iomsg); break; + case EXEC_INQUIRE: WALK_SUBEXPR ((*c)->ext.inquire->unit); WALK_SUBEXPR ((*c)->ext.inquire->file); @@ -643,12 +665,14 @@ gfc_code_walker (gfc_code **c, walk_code_fn_t code WALK_SUBEXPR ((*c)->ext.inquire->size); WALK_SUBEXPR ((*c)->ext.inquire->round); break; + case EXEC_WAIT: WALK_SUBEXPR ((*c)->ext.wait->unit); WALK_SUBEXPR ((*c)->ext.wait->iostat); WALK_SUBEXPR ((*c)->ext.wait->iomsg); WALK_SUBEXPR ((*c)->ext.wait->id); break; + case EXEC_READ: case EXEC_WRITE: WALK_SUBEXPR ((*c)->ext.dt->io_unit); @@ -669,6 +693,7 @@ gfc_code_walker (gfc_code **c, walk_code_fn_t code WALK_SUBEXPR ((*c)->ext.dt->sign); WALK_SUBEXPR ((*c)->ext.dt->extra_comma); break; + case EXEC_OMP_DO: case EXEC_OMP_PARALLEL: case EXEC_OMP_PARALLEL_DO: @@ -689,6 +714,7 @@ gfc_code_walker (gfc_code **c, walk_code_fn_t code default: break; } + WALK_SUBEXPR ((*c)->expr1); WALK_SUBEXPR ((*c)->expr2); WALK_SUBEXPR ((*c)->expr3);