From: Thomas Koenig <tkoenig@netcologne.de>
To: sgk@troutmask.apl.washington.edu, 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 10:09:00 -0000 [thread overview]
Message-ID: <fa6d6632-abe2-d017-305d-75fbe4332e62@netcologne.de> (raw)
In-Reply-To: <20180125021147.GA52679@troutmask.apl.washington.edu>
Hi Steve,
I have a couple of questions before I have to hurry off to work:
First, why is
> @@ -2253,22 +2253,19 @@ gfc_simplify_dim (gfc_expr *x, gfc_expr *y)
> gfc_expr*
> gfc_simplify_dot_product (gfc_expr *vector_a, gfc_expr *vector_b)
> {
> + /* If vector_a is a zero-sized array, the result is 0 for INTEGER,
> + REAL, and COMPLEX types and .false. for LOGICAL. */
> + if (vector_a->shape && mpz_get_si (vector_a->shape[0]) == 0)
> + {
> + if (vector_a->ts.type == BT_LOGICAL)
> + return gfc_get_logical_expr (gfc_default_logical_kind, NULL, false);
> + else
> + return gfc_get_int_expr (gfc_default_integer_kind, NULL, 0);
> + }
in front of
> - gfc_expr temp;
> -
> if (!is_constant_array_expr (vector_a)
> || !is_constant_array_expr (vector_b))
> return NULL;
and / or why is the test only done for one variable?
Second, why do you remove this
> - temp.value.op.op = INTRINSIC_NONE;
> - temp.value.op.op1 = vector_a;
> - temp.value.op.op2 = vector_b;
> - gfc_type_convert_binary (&temp, 1);
block of code? What would happen for code like
integer, dimension(2), parameter :: a = [ 1,2]
real, dimension(2), parameter :: b = [1.0,2.0]
real, parameter :: c = dot_product(a,b)
?
Regards
Thomas
next prev parent reply other threads:[~2018-01-25 7:38 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 [this message]
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
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=fa6d6632-abe2-d017-305d-75fbe4332e62@netcologne.de \
--to=tkoenig@netcologne.de \
--cc=fortran@gcc.gnu.org \
--cc=gcc-patches@gcc.gnu.org \
--cc=sgk@troutmask.apl.washington.edu \
/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).