public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "saitofuyuki at jamstec dot go.jp" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug libfortran/108937] Intrinsic IBITS(I,POS,LEN) fails when LEN equals to BIT_SIZE(I).
Date: Mon, 27 Feb 2023 01:44:44 +0000	[thread overview]
Message-ID: <bug-108937-4-HWV84T7x5u@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-108937-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #1 from saitofuyuki at jamstec dot go.jp ---
Sorry, I missed to attach the test program.


program test_bits
  implicit none
  integer,parameter :: KT = 4
  integer,parameter :: lbits = bit_size(0_KT)
  integer(kind=KT) x, y0, y1
  integer(kind=KT) p, l

  x = -1
  p = 0
  l = lbits

100 format('IBITS(', I0, ',', I0, ',', I0, ')')
101 format(A, 1x, I0, 1x, B32.32)
  y0 = ibits(x, p, l)
  y1 = ibits_1(x, p, l)
  write(*, 100) x, p, l
  write(*, 101) 'intrinsic', y0, y0
  write(*, 101) 'expected',  y1, y1
  stop
contains
  elemental integer(kind=KT) function ibits_1(I, POS, LEN) result(n)
    !! IBITS(I, POS, LEN) = (I >> POS) & ~((~0) << LEN)
    implicit none
    integer(kind=KT),intent(in) :: I
    integer,         intent(in) :: POS, LEN
    n = IAND(ISHFT(I, - POS), NOT(ISHFT(-1_KT, LEN)))
  end function ibits_1
end program test_bits

  reply	other threads:[~2023-02-27  1:44 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-27  1:43 [Bug libfortran/108937] New: " saitofuyuki at jamstec dot go.jp
2023-02-27  1:44 ` saitofuyuki at jamstec dot go.jp [this message]
2023-02-27  2:26 ` [Bug libfortran/108937] " kargl at gcc dot gnu.org
2023-02-27  3:01 ` saitofuyuki at jamstec dot go.jp
2023-02-27 18:14 ` kargl at gcc dot gnu.org
2023-02-27 19:32 ` anlauf at gcc dot gnu.org
2023-02-27 20:21 ` [Bug fortran/108937] " anlauf at gcc dot gnu.org
2023-02-27 20:55 ` anlauf at gcc dot gnu.org
2023-02-27 21:30 ` cvs-commit at gcc dot gnu.org
2023-02-27 23:07 ` saitofuyuki at jamstec dot go.jp
2023-03-04 19:51 ` cvs-commit at gcc dot gnu.org
2023-03-05 19:35 ` cvs-commit at gcc dot gnu.org
2023-03-05 19:36 ` cvs-commit at gcc dot gnu.org
2023-03-05 19:40 ` 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-108937-4-HWV84T7x5u@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).