From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 43329 invoked by alias); 25 Jan 2018 19:19:18 -0000 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 Received: (qmail 43286 invoked by uid 89); 25 Jan 2018 19:19:18 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.1 required=5.0 tests=AWL,BAYES_00,KAM_LAZY_DOMAIN_SECURITY,RCVD_IN_DNSWL_NONE,T_RP_MATCHES_RCVD autolearn=no version=3.3.2 spammy= X-Spam-User: qpsmtpd, 2 recipients X-HELO: troutmask.apl.washington.edu Received: from troutmask.apl.washington.edu (HELO troutmask.apl.washington.edu) (128.95.76.21) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 25 Jan 2018 19:19:17 +0000 Received: from troutmask.apl.washington.edu (localhost [127.0.0.1]) by troutmask.apl.washington.edu (8.15.2/8.15.2) with ESMTPS id w0PJJFp0092523 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Thu, 25 Jan 2018 11:19:15 -0800 (PST) (envelope-from sgk@troutmask.apl.washington.edu) Received: (from sgk@localhost) by troutmask.apl.washington.edu (8.15.2/8.15.2/Submit) id w0PJJEUi092522; Thu, 25 Jan 2018 11:19:14 -0800 (PST) (envelope-from sgk) Date: Thu, 25 Jan 2018 19:23:00 -0000 From: Steve Kargl To: Thomas Koenig Cc: fortran@gcc.gnu.org, gcc-patches@gcc.gnu.org Subject: Re: [PATCH] PR fortran/83998 -- fix dot_product on 0-sized arrays Message-ID: <20180125191914.GA92515@troutmask.apl.washington.edu> Reply-To: sgk@troutmask.apl.washington.edu References: <20180125021147.GA52679@troutmask.apl.washington.edu> <20180125150610.GA53868@troutmask.apl.washington.edu> <20180125190704.GA3302@troutmask.apl.washington.edu> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180125190704.GA3302@troutmask.apl.washington.edu> User-Agent: Mutt/1.9.2 (2017-12-15) X-SW-Source: 2018-01/txt/msg02113.txt.bz2 On Thu, Jan 25, 2018 at 11:07:04AM -0800, Steve Kargl wrote: > On Thu, Jan 25, 2018 at 07:58:22PM +0100, Thomas Koenig wrote: > > Hi Steve, > > > > thanks for your explanations. > > > > The patch is OK for trunk. Thanks a lot! > > > > Upon even further reading, the code segment with temp might > be needed. If one looks in compute_dot_product(), one finds > > result = gfc_get_constant_expr (matrix_a->ts.type, matrix_a->ts.kind, > &matrix_a->where); > init_result_expr (result, 0, NULL); > > which sets the type of result to matrix_a, unconditionally. > We may however still benefit from mixed-mode math during > the summation because we have > > result = gfc_add (result, gfc_multiply (c, gfc_copy_expr (b))); > > and both gfc_add and gfc_multiply should do mixed-mode math. > > I'll check before I commit. This code confirms proper handling of mixed-mode math. program p integer, parameter :: a(2) = [1, 2] real, parameter :: b(2) = [1., 2.] real c c = dot_product(a,b) print *, c end -- Steve