From: Steve Kargl <sgk@troutmask.apl.washington.edu>
To: Thomas Koenig <tkoenig@netcologne.de>
Cc: fortran@gcc.gnu.org, gcc-patches@gcc.gnu.org
Subject: Re: [PATCH] PR fortran/83998 -- fix dot_product on 0-sized arrays
Date: Thu, 25 Jan 2018 19:23:00 -0000 [thread overview]
Message-ID: <20180125191914.GA92515@troutmask.apl.washington.edu> (raw)
In-Reply-To: <20180125190704.GA3302@troutmask.apl.washington.edu>
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
prev parent reply other threads:[~2018-01-25 19:19 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-01-25 2:42 Steve Kargl
2018-01-25 10:09 ` Thomas Koenig
2018-01-25 15:26 ` Steve Kargl
2018-01-25 18:44 ` Steve Kargl
2018-01-25 19:13 ` Thomas Koenig
2018-01-25 19:15 ` Steve Kargl
2018-01-25 19:23 ` Steve Kargl [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180125191914.GA92515@troutmask.apl.washington.edu \
--to=sgk@troutmask.apl.washington.edu \
--cc=fortran@gcc.gnu.org \
--cc=gcc-patches@gcc.gnu.org \
--cc=tkoenig@netcologne.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).