public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "jvdelisle at gcc dot gnu dot org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug fortran/31964] ishftc fails with certain thrid argument
Date: Thu, 17 May 2007 00:49:00 -0000	[thread overview]
Message-ID: <20070517004921.27981.qmail@sourceware.org> (raw)
In-Reply-To: <bug-31964-12424@http.gcc.gnu.org/bugzilla/>



------- Comment #3 from jvdelisle at gcc dot gnu dot org  2007-05-17 01:49 -------
I think we have an off by one when setting mask.  I want to do some testing and
double check on all this.  Here is a patch:

Index: ishftc.c
===================================================================
*** ishftc.c    (revision 124756)
--- ishftc.c    (working copy)
*************** ishftc4 (GFC_INTEGER_4 i, GFC_INTEGER_4 
*** 45,51 ****
    if (shift == 0 || shift == size)
      return i;

!   mask = (~(GFC_INTEGER_4)0) << size;
    bits = i & ~mask;
    return (i & mask) | (bits >> (size - shift)) | ((i << shift) & ~mask);
  }
--- 45,51 ----
    if (shift == 0 || shift == size)
      return i;

!   mask = (~(GFC_INTEGER_4)0) << (size - 1);
    bits = i & ~mask;
    return (i & mask) | (bits >> (size - shift)) | ((i << shift) & ~mask);
  }
*************** ishftc8 (GFC_INTEGER_8 i, GFC_INTEGER_4 
*** 65,71 ****
    if (shift == 0 || shift == size)
      return i;

!   mask = (~(GFC_INTEGER_8)0) << size;
    bits = i & ~mask;
    return (i & mask) | (bits >> (size - shift)) | ((i << shift) & ~mask);
  }
--- 65,71 ----
    if (shift == 0 || shift == size)
      return i;

!   mask = (~(GFC_INTEGER_8)0) << (size - 1);
    bits = i & ~mask;
    return (i & mask) | (bits >> (size - shift)) | ((i << shift) & ~mask);
  }
*************** ishftc16 (GFC_INTEGER_16 i, GFC_INTEGER_
*** 86,92 ****
    if (shift == 0 || shift == size)
      return i;

!   mask = (~(GFC_INTEGER_16)0) << size;
    bits = i & ~mask;
    return (i & mask) | (bits >> (size - shift)) | ((i << shift) & ~mask);
  }
--- 86,92 ----
    if (shift == 0 || shift == size)
      return i;

!   mask = (~(GFC_INTEGER_16)0) << (size - 1);
    bits = i & ~mask;
    return (i & mask) | (bits >> (size - shift)) | ((i << shift) & ~mask);
  }


-- 

jvdelisle at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |jvdelisle at gcc dot gnu dot
                   |dot org                     |org
             Status|NEW                         |ASSIGNED
   Last reconfirmed|2007-05-17 01:30:46         |2007-05-17 01:49:20
               date|                            |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31964


  parent reply	other threads:[~2007-05-17  0:49 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-05-16 22:42 [Bug fortran/31964] New: " trumsko at yahoo dot com
2007-05-16 23:51 ` [Bug fortran/31964] " kargl at gcc dot gnu dot org
2007-05-17  0:31 ` jvdelisle at gcc dot gnu dot org
2007-05-17  0:49 ` jvdelisle at gcc dot gnu dot org [this message]
2007-05-17  3:00 ` jvdelisle at gcc dot gnu dot org
2007-05-18  5:54 ` jvdelisle at gcc dot gnu dot org
2007-05-19  1:04 ` jvdelisle at gcc dot gnu dot org
2007-05-19  1:08 ` jvdelisle at gcc dot gnu dot org
2007-05-19  1:10 ` [Bug fortran/31964] [4.2, 4.1 only]ishftc " jvdelisle at gcc dot gnu dot org
2007-05-24  5:22 ` jvdelisle at gcc dot gnu dot org
2007-05-24  5:51 ` jvdelisle at gcc dot gnu dot org
2007-05-24  5:53 ` jvdelisle at gcc dot gnu dot org
2007-05-24  5:58 ` jvdelisle at gcc dot gnu dot org
2007-05-24  5:59 ` jvdelisle at gcc dot gnu dot 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=20070517004921.27981.qmail@sourceware.org \
    --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).