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/96859] Wrong answer with intrinsic merge_bits
Date: Tue, 01 Sep 2020 15:02:58 +0000	[thread overview]
Message-ID: <bug-96859-4-RsiPt0a8ci@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-96859-4@http.gcc.gnu.org/bugzilla/>

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96859

--- Comment #8 from Steve Kargl <sgk at troutmask dot apl.washington.edu> ---
On Tue, Sep 01, 2020 at 12:52:49PM +0000, jakub at gcc dot gnu.org wrote:
> 
> --- Comment #5 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
> I think this boils down to:
> program foo
>   print *, int(o'1234567',2), int(o'1234567',4)
> end program foo
> I believe ifort prints
> 14711 342391
> while gfortran prints
> -18057 342391
> Since 01234567 in C is 0x53977, after that is cast to 16-bit integer that
> should be 0x3977 and thus 14711.
> 

The Fortran standard states how the BOZ string of bits
is padded or truncated if it contains too few or too
many bits.  See F2018, 16.3.3.  Also no that the 
handling of the sign bit is processor dependent.

--
Steve

  parent reply	other threads:[~2020-09-01 15:02 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-31  6:31 [Bug fortran/96859] New: " zhen.xu@compiler-dev.com
2020-08-31  9:53 ` [Bug fortran/96859] " dominiq at lps dot ens.fr
2020-08-31 16:30 ` kargl at gcc dot gnu.org
2020-09-01 12:17 ` zhen.xu@compiler-dev.com
2020-09-01 12:22 ` zhen.xu@compiler-dev.com
2020-09-01 12:52 ` jakub at gcc dot gnu.org
2020-09-01 13:10 ` jakub at gcc dot gnu.org
2020-09-01 13:30 ` jakub at gcc dot gnu.org
2020-09-01 15:02 ` sgk at troutmask dot apl.washington.edu [this message]
2020-09-01 15:20 ` jakub at gcc dot gnu.org
2020-09-01 15:54 ` sgk at troutmask dot apl.washington.edu
2020-09-02 10:19 ` cvs-commit at gcc dot gnu.org
2020-09-11  7:47 ` cvs-commit at gcc dot gnu.org
2021-03-26 18:43 ` anlauf at gcc dot gnu.org
2021-05-31 17:23 ` dominiq at lps dot ens.fr
2021-09-17  6:40 ` pinskia 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-96859-4-RsiPt0a8ci@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).