From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 90394 invoked by alias); 25 Jan 2018 07:38:03 -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 90368 invoked by uid 89); 25 Jan 2018 07:38:02 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.0 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_LOW,SPF_PASS,T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 spammy=hurry X-Spam-User: qpsmtpd, 2 recipients X-HELO: cc-smtpout1.netcologne.de Received: from cc-smtpout1.netcologne.de (HELO cc-smtpout1.netcologne.de) (89.1.8.211) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 25 Jan 2018 07:38:00 +0000 Received: from cc-smtpin3.netcologne.de (cc-smtpin3.netcologne.de [89.1.8.203]) by cc-smtpout1.netcologne.de (Postfix) with ESMTP id 1C1FC135CA; Thu, 25 Jan 2018 08:37:58 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by cc-smtpin3.netcologne.de (Postfix) with ESMTP id 18AB711D99; Thu, 25 Jan 2018 08:37:58 +0100 (CET) Received: from [78.35.141.138] (helo=cc-smtpin3.netcologne.de) by localhost with ESMTP (eXpurgate 4.1.9) (envelope-from ) id 5a698956-02b7-7f0000012729-7f000001899d-1 for ; Thu, 25 Jan 2018 08:37:58 +0100 Received: from [192.168.178.20] (xdsl-78-35-141-138.netcologne.de [78.35.141.138]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by cc-smtpin3.netcologne.de (Postfix) with ESMTPSA; Thu, 25 Jan 2018 08:37:55 +0100 (CET) Subject: Re: [PATCH] PR fortran/83998 -- fix dot_product on 0-sized arrays To: sgk@troutmask.apl.washington.edu, fortran@gcc.gnu.org, gcc-patches@gcc.gnu.org References: <20180125021147.GA52679@troutmask.apl.washington.edu> From: Thomas Koenig Message-ID: Date: Thu, 25 Jan 2018 10:09:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.5.2 MIME-Version: 1.0 In-Reply-To: <20180125021147.GA52679@troutmask.apl.washington.edu> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-SW-Source: 2018-01/txt/msg02078.txt.bz2 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