From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 30006 invoked by alias); 27 Oct 2011 23:35:55 -0000 Received: (qmail 32468 invoked by uid 22791); 27 Oct 2011 23:33:26 -0000 X-SWARE-Spam-Status: No, hits=0.6 required=5.0 tests=AWL,BAYES_50,KAM_STOCKGEN,RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from smtp25.services.sfr.fr (HELO smtp25.services.sfr.fr) (93.17.128.120) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 27 Oct 2011 23:33:12 +0000 Received: from filter.sfr.fr (localhost [127.0.0.1]) by msfrf2512.sfr.fr (SMTP Server) with ESMTP id C5AA67000040; Fri, 28 Oct 2011 01:33:11 +0200 (CEST) Received: from gimli.local (145.15.72.86.rev.sfr.net [86.72.15.145]) by msfrf2512.sfr.fr (SMTP Server) with ESMTP id 87D077000089; Fri, 28 Oct 2011 01:33:11 +0200 (CEST) X-SFR-UUID: 20111027233311556.87D077000089@msfrf2512.sfr.fr Content-Type: multipart/mixed; boundary="===============0846116281918064916==" MIME-Version: 1.0 From: Mikael Morin To: gfortran , GCC patches Message-ID: <20111027233311.18581.79772@gimli.local> In-Reply-To: <20111027233305.18581.72802@gimli.local> References: <20111027232818.18581.901@gimli.local> <20111027233305.18581.72802@gimli.local> Subject: [Patch, fortran] [54/66] inline sum and product: Prevent regressions: Add dependency checking. Date: Thu, 27 Oct 2011 23:43:00 -0000 X-IsSubscribed: yes Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org X-SW-Source: 2011-10/txt/msg02577.txt.bz2 --===============0846116281918064916== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-length: 56 This adds dependency checking for inline functions. OK? --===============0846116281918064916== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="pr43829-54.CL" Content-length: 277 2011-10-19 Mikael Morin * trans.h (gfc_inline_intrinsic_function_p): Move prototype... * gfortran.h (gfc_inline_intrinsic_function_p): ... here. * dependency.c (gfc_check_argument_var_dependency): Check dependencies of inline intrinsics' arguments. --===============0846116281918064916== Content-Type: text/x-diff; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="pr43829-54.patch" Content-length: 1721 diff --git a/dependency.c b/dependency.c index c43af00..fd7fa73 100644 --- a/dependency.c +++ b/dependency.c @@ -713,6 +713,17 @@ gfc_check_argument_var_dependency (gfc_expr *var, sym_intent intent, return gfc_check_fncall_dependency (var, intent, NULL, expr->value.function.actual, ELEM_CHECK_VARIABLE); + + if (gfc_inline_intrinsic_function_p (expr)) + { + /* The TRANSPOSE case should have been caught in the + noncopying intrinsic case above. */ + gcc_assert (expr->value.function.isym->id != GFC_ISYM_TRANSPOSE); + + return gfc_check_fncall_dependency (var, intent, NULL, + expr->value.function.actual, + ELEM_CHECK_VARIABLE); + } } return 0; diff --git a/gfortran.h b/gfortran.h index da3477d..b869ca3 100644 --- a/gfortran.h +++ b/gfortran.h @@ -2880,6 +2880,9 @@ void gfc_generate_code (gfc_namespace *); void gfc_generate_module_code (gfc_namespace *); void gfc_init_coarray_decl (bool); +/* trans-intrinsic.c */ +bool gfc_inline_intrinsic_function_p (gfc_expr *); + /* bbt.c */ typedef int (*compare_fn) (void *, void *); void gfc_insert_bbt (void *, void *, compare_fn); diff --git a/trans.h b/trans.h index 4d745f1..5757865 100644 --- a/trans.h +++ b/trans.h @@ -396,9 +396,6 @@ tree gfc_builtin_decl_for_float_kind (enum built_in_function, int); tree gfc_conv_intrinsic_subroutine (gfc_code *); void gfc_conv_intrinsic_function (gfc_se *, gfc_expr *); -/* Is the intrinsic expanded inline. */ -bool gfc_inline_intrinsic_function_p (gfc_expr *); - /* Does an intrinsic map directly to an external library call This is true for array-returning intrinsics, unless gfc_inline_intrinsic_function_p returns true. */ --===============0846116281918064916==--