From: Jerry DeLisle <jvdelisle@charter.net>
To: "fortran@gcc.gnu.org" <fortran@gcc.gnu.org>
Cc: GCC Patches <gcc-patches@gcc.gnu.org>
Subject: [patch, fortran] Bug 84506 - [6/7/8 Regression]INQUIRE(pos=) always sets pos=0 with -fdefault-integer-8
Date: Fri, 23 Feb 2018 16:27:00 -0000 [thread overview]
Message-ID: <166bfa30-941f-43a4-2e72-1046f4929ba8@charter.net> (raw)
[-- Attachment #1: Type: text/plain, Size: 719 bytes --]
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 <jvdelisle@gcc.gnu.org>
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.
[-- Attachment #2: pr84506.diff --]
[-- Type: text/x-patch, Size: 996 bytes --]
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,
next reply other threads:[~2018-02-23 16:27 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-02-23 16:27 Jerry DeLisle [this message]
2018-02-23 17:33 ` 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=166bfa30-941f-43a4-2e72-1046f4929ba8@charter.net \
--to=jvdelisle@charter.net \
--cc=fortran@gcc.gnu.org \
--cc=gcc-patches@gcc.gnu.org \
/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).