public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "anlauf at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug fortran/97272] Wrong answer from MAXLOC with character arg
Date: Mon, 05 Oct 2020 07:16:38 +0000 [thread overview]
Message-ID: <bug-97272-4-P6lqYlblVM@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-97272-4@http.gcc.gnu.org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97272
--- Comment #6 from anlauf at gcc dot gnu.org ---
(In reply to Bill Long from comment #5)
> The original intent of adding the KIND argument was because some
> implementations used a 32-bit integer for the result, and it is possible for
> the answer to be larger than 2**31-1. Just checking to be sure that the
> underlying library code returns a 64-bit integer that can later be converted
> based on the KIND value.
Did you try? It's not exactly fast, but
program test
implicit none
integer(8) :: k, l = 10 + 2_8**32
character, allocatable :: a(:)
allocate (a(l))
print *, l
a(:) = 'a'
l = l - 1
a(l) = 'b'
print *, l
print *, size (a, kind=8)
k = maxloc (a, dim=1, kind=8, back=.true.)
print *, 'k = ', k, 'a(k) = ', a(k)
end
works for me on master now on a 64-bit platform:
4294967306
4294967305
4294967306
k = 4294967305 a(k) = b
next prev parent reply other threads:[~2020-10-05 7:16 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-10-02 14:03 [Bug fortran/97272] New: " longb at cray dot com
2020-10-02 19:44 ` [Bug fortran/97272] " anlauf at gcc dot gnu.org
2020-10-02 20:02 ` anlauf at gcc dot gnu.org
2020-10-02 20:32 ` anlauf at gcc dot gnu.org
2020-10-04 18:24 ` cvs-commit at gcc dot gnu.org
2020-10-04 21:53 ` longb at cray dot com
2020-10-05 7:16 ` anlauf at gcc dot gnu.org [this message]
2020-10-08 16:55 ` cvs-commit at gcc dot gnu.org
2020-10-08 20:29 ` cvs-commit at gcc dot gnu.org
2020-10-08 21:00 ` anlauf at gcc dot gnu.org
2021-01-22 21:08 ` longb at cray dot com
2021-01-22 21:24 ` anlauf at gcc dot gnu.org
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=bug-97272-4-P6lqYlblVM@http.gcc.gnu.org/bugzilla/ \
--to=gcc-bugzilla@gcc.gnu.org \
--cc=gcc-bugs@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).