From: Steve Kargl <sgk@troutmask.apl.washington.edu>
To: FX Coudert <fxcoudert@gmail.com>
Cc: Elias Toivanen <elias.a.toivanen@gmail.com>, fortran@gcc.gnu.org
Subject: Re: Request to improve docs: Fortran integer ranges vs. machine representation
Date: Fri, 26 Jan 2024 13:41:59 -0800 [thread overview]
Message-ID: <ZbQnJ5tvCszUOVeW@troutmask.apl.washington.edu> (raw)
In-Reply-To: <7462D05F-F9F6-4F29-8FA7-98C9C1760538@gmail.com>
On Fri, Jan 26, 2024 at 09:23:56PM +0100, FX Coudert wrote:
>
> This is, for example, legal code (and handled by gfortran as expected):
>
> use iso_fortran_env
> implicit none
> integer(int8) :: j
> data j /-128_int8/
> print *, j
> end
>
Interesting example.
% gfcx -o z a.f90 && ./z
-128
% gfcx -o z -pedantic a.f90 && ./z
a.f90:5:20:
5 | data j /-128_int8/
| 1
Error: Integer too big for its kind at (1). This check can be disabled with the option ‘-fno-range-check’
% gfcx -o z -pedantic -fno-range-check a.f90 && ./z
a.f90:5:20:
5 | data j /-128_int8/
| 1
Error: Integer too big for its kind at (1). This check can be disabled with the option ‘-fno-range-check’
:-)
--
Steve
next prev parent reply other threads:[~2024-01-26 21:42 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-26 13:44 Elias Toivanen
2024-01-26 16:50 ` Steve Kargl
2024-01-26 20:23 ` FX Coudert
2024-01-26 21:41 ` Steve Kargl [this message]
2024-01-26 22:38 ` FX Coudert
2024-01-27 2:19 ` Steve Kargl
2024-01-28 10:18 ` Elias Toivanen
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=ZbQnJ5tvCszUOVeW@troutmask.apl.washington.edu \
--to=sgk@troutmask.apl.washington.edu \
--cc=elias.a.toivanen@gmail.com \
--cc=fortran@gcc.gnu.org \
--cc=fxcoudert@gmail.com \
/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).