From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 72045 invoked by alias); 23 Feb 2018 16:27:24 -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 72019 invoked by uid 89); 23 Feb 2018 16:27:23 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-24.5 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,KAM_NUMSUBJECT,RCVD_IN_DNSWL_NONE,SPF_PASS,T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 spammy= X-Spam-User: qpsmtpd, 2 recipients X-HELO: mtaout002-public.msg.strl.va.charter.net Received: from mtaout002-public.msg.strl.va.charter.net (HELO mtaout002-public.msg.strl.va.charter.net) (68.114.190.27) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 23 Feb 2018 16:27:21 +0000 Received: from impout002 ([68.114.189.17]) by mtaout002.msg.strl.va.charter.net (InterMail vM.9.00.023.01 201-2473-194) with ESMTP id <20180223162720.OKFD7360.mtaout002.msg.strl.va.charter.net@impout002>; Fri, 23 Feb 2018 10:27:20 -0600 Received: from amda8.localdomain ([96.41.213.35]) by impout002 with charter.net id EGTK1x00P0mPCJg01GTKi3; Fri, 23 Feb 2018 10:27:20 -0600 X-Authority-Analysis: v=2.2 cv=C6eZ8UH+ c=1 sm=1 tr=0 a=NNeuWy7OTYa7gJ+3pFFB5Q==:117 a=NNeuWy7OTYa7gJ+3pFFB5Q==:17 a=x7bEGLp0ZPQA:10 a=r77TgQKjGQsHNAKrUKIA:9 a=mDV3o1hIAAAA:8 a=W4XmWXXn-ktcLKNq2k4A:9 a=QEXdDO2ut3YA:10 a=F7NdMwfHTzAR5OQ2Pj4A:9 a=hquHOILUSkIA:10 a=_FVE-zBwftR9WsbkzFJk:22 X-Auth-id: anZkZWxpc2xlQGNoYXJ0ZXIubmV0 To: "fortran@gcc.gnu.org" Cc: GCC Patches From: Jerry DeLisle Subject: [patch, fortran] Bug 84506 - [6/7/8 Regression]INQUIRE(pos=) always sets pos=0 with -fdefault-integer-8 Message-ID: <166bfa30-941f-43a4-2e72-1046f4929ba8@charter.net> Date: Fri, 23 Feb 2018 16:27:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.5.2 MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="------------A69C0E58AD57C964E3FEC2E5" X-SW-Source: 2018-02/txt/msg01333.txt.bz2 This is a multi-part message in MIME format. --------------A69C0E58AD57C964E3FEC2E5 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-length: 719 Hi Folks, This bug is a result of a range check we do on kind=8 unit numbers to make sure they fall within the range values of a kind=4 integer. We were limiting this range to positive values. I think when we introduced the newunit feature which uses negative unit values, we missed this adjustment. The attached patch is trivial. Regression tested on x86_86-pc-linux-gnu. I will back port to 6 an 7 after approval here. I will use the case in the PR as a new test case. OK for trunk? Regards, Jerry 2018-02-23 Jerry DeLisle PR fortran/84506 * trans-io.c (set_parameter_value_inquire): Adjust range check of negative unit values for kind=8 units to the kind=4 negative limit. --------------A69C0E58AD57C964E3FEC2E5 Content-Type: text/x-patch; name="pr84506.diff" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="pr84506.diff" Content-length: 996 diff --git a/gcc/fortran/trans-io.c b/gcc/fortran/trans-io.c index 021c788ba54..36adb034475 100644 --- a/gcc/fortran/trans-io.c +++ b/gcc/fortran/trans-io.c @@ -639,12 +639,12 @@ set_parameter_value_inquire (stmtblock_t *block, tree var, /* Don't evaluate the UNIT number multiple times. */ se.expr = gfc_evaluate_now (se.expr, &se.pre); - /* UNIT numbers should be greater than zero. */ + /* UNIT numbers should be greater than the min. */ i = gfc_validate_kind (BT_INTEGER, 4, false); + val = gfc_conv_mpz_to_tree (gfc_integer_kinds[i].pedantic_min_int, 4); cond1 = build2_loc (input_location, LT_EXPR, logical_type_node, se.expr, - fold_convert (TREE_TYPE (se.expr), - integer_zero_node)); + fold_convert (TREE_TYPE (se.expr), val)); /* UNIT numbers should be less than the max. */ val = gfc_conv_mpz_to_tree (gfc_integer_kinds[i].huge, 4); cond2 = build2_loc (input_location, GT_EXPR, logical_type_node, --------------A69C0E58AD57C964E3FEC2E5--