public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "sgk at troutmask dot apl.washington.edu" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug fortran/92639] Error: Integer too big for its kind at (1)
Date: Wed, 01 Mar 2023 18:32:06 +0000 [thread overview]
Message-ID: <bug-92639-4-daEtIY50sT@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-92639-4@http.gcc.gnu.org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92639
--- Comment #4 from Steve Kargl <sgk at troutmask dot apl.washington.edu> ---
On Wed, Mar 01, 2023 at 05:51:29PM +0000, cessenat at gmail dot com wrote:
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92639
>
> --- Comment #2 from Olivier Cessenat <cessenat at gmail dot com> ---
> integer(kind=4) valid range is -2147483648_4 to +2147483647_4.
> So I consider this is a gfortran bug.
>
> Moreover, if -2147483648_4 is considered out of range, why
> -2147483647_4 - 1_4 is not ? Constant elimination makes it evaluated to
> -2147483648_4.
>
> I disagree with the term "there are no negative integers"
> [-2147483648_4 is equal to +2147483648_4]
^^^^^^^^^^^^
exceeds huge(1)
% cat a.f90
print *, huge(1)
end
% gfortran -o z a.f90 && ./z
2147483647
I've already explained the issue. But, I'll go over it
one more time. -2147483648_4 is parsed as unary minus
operator and an operand of 2147483648_4. 2147483648_4
exceeds huge(1). Fortunately, gfortran can save you,
and the error message even tells you.
1 | i = -2147483648_4
| 1
Error: Integer too big for its kind at (1). This check can be
disabled with the option '-fno-range-check'
So, let me amend the quote above "there are no negative
integer-literal constants."
prev parent reply other threads:[~2023-03-01 18:32 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-11-23 17:11 [Bug fortran/92639] New: " gsocshubham at gmail dot com
2023-03-01 17:51 ` [Bug fortran/92639] " cessenat at gmail dot com
2023-03-01 18:29 ` jvdelisle at gcc dot gnu.org
2023-03-01 18:32 ` sgk at troutmask dot apl.washington.edu [this message]
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-92639-4-daEtIY50sT@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).