public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/31964]  New: ishftc fails with certain thrid argument
@ 2007-05-16 22:42 trumsko at yahoo dot com
  2007-05-16 23:51 ` [Bug fortran/31964] " kargl at gcc dot gnu dot org
                   ` (12 more replies)
  0 siblings, 13 replies; 14+ messages in thread
From: trumsko at yahoo dot com @ 2007-05-16 22:42 UTC (permalink / raw)
  To: gcc-bugs

If the third argument of ishftc equals BIT_SIZE of the first argument, the
result shall be the same as if the last argument was omitted. 

program main
  implicit none

  integer aint

  aint=1
  write(*,*) BIT_SIZE(aint)
  write(*,*) ishftc(aint,1)
  write(*,*) ishftc(aint,1,32)
  write(*,*) ishftc(aint,1,BIT_SIZE(aint))

end program main

Produces the following wrong output:
          32
           2
           2
           2


/tmp/forttest3 $ gfortran -v
Using built-in specs.
Target: i386-pc-linux-gnu
Configured with: /home/fxcoudert/gfortran_nightbuild/trunk/configure
--prefix=/home/fxcoudert/gfortran_nightbuild/irun-20070426
--enable-languages=c,fortran --disable-decimal-float --build=i386-pc-linux-gnu
--enable-checking=release
--with-gmp=/home/fxcoudert/gfortran_nightbuild/software
Thread model: posix
gcc version 4.3.0 20070426 (experimental)


-- 
           Summary: ishftc fails with certain thrid argument
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: trumsko at yahoo dot com
 GCC build triplet: i686-redhat-linux-gnu
  GCC host triplet: i686-redhat-linux-gnu
GCC target triplet: i686-redhat-linux-gnu


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


^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Bug fortran/31964] ishftc fails with certain thrid argument
  2007-05-16 22:42 [Bug fortran/31964] New: ishftc fails with certain thrid argument trumsko at yahoo dot com
@ 2007-05-16 23:51 ` kargl at gcc dot gnu dot org
  2007-05-17  0:31 ` jvdelisle at gcc dot gnu dot org
                   ` (11 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: kargl at gcc dot gnu dot org @ 2007-05-16 23:51 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from kargl at gcc dot gnu dot org  2007-05-17 00:51 -------
What output were you expecting? 

  write(*,*) ishftc(aint,1)
  write(*,*) ishftc(aint,1,32)
  write(*,*) ishftc(aint,1,BIT_SIZE(aint))

All three of these statements are shifting the 32-bit representation of
of 1 to left and wrapping the 1 shifted bit around.


-- 

kargl at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |kargl at gcc dot gnu dot org


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


^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Bug fortran/31964] ishftc fails with certain thrid argument
  2007-05-16 22:42 [Bug fortran/31964] New: ishftc fails with certain thrid argument 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
                   ` (10 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: jvdelisle at gcc dot gnu dot org @ 2007-05-17  0:31 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from jvdelisle at gcc dot gnu dot org  2007-05-17 01:30 -------
$ gfc shifter.f90 
$ ./a.out
          32
           2
           1
           1
$ ifort shifter.f90 
$ ./a.out
          32
           2
           2
           2
$ 


-- 

jvdelisle at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2007-05-17 01:30:46
               date|                            |


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


^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Bug fortran/31964] ishftc fails with certain thrid argument
  2007-05-16 22:42 [Bug fortran/31964] New: ishftc fails with certain thrid argument 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
  2007-05-17  3:00 ` jvdelisle at gcc dot gnu dot org
                   ` (9 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: jvdelisle at gcc dot gnu dot org @ 2007-05-17  0:49 UTC (permalink / raw)
  To: gcc-bugs



------- 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


^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Bug fortran/31964] ishftc fails with certain thrid argument
  2007-05-16 22:42 [Bug fortran/31964] New: ishftc fails with certain thrid argument trumsko at yahoo dot com
                   ` (2 preceding siblings ...)
  2007-05-17  0:49 ` jvdelisle at gcc dot gnu dot org
@ 2007-05-17  3:00 ` jvdelisle at gcc dot gnu dot org
  2007-05-18  5:54 ` jvdelisle at gcc dot gnu dot org
                   ` (8 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: jvdelisle at gcc dot gnu dot org @ 2007-05-17  3:00 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from jvdelisle at gcc dot gnu dot org  2007-05-17 04:00 -------
The patch in comment #3 is incorrect.  I have the correct patch coming and will
post to list for approval.


-- 


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


^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Bug fortran/31964] ishftc fails with certain thrid argument
  2007-05-16 22:42 [Bug fortran/31964] New: ishftc fails with certain thrid argument trumsko at yahoo dot com
                   ` (3 preceding siblings ...)
  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
                   ` (7 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: jvdelisle at gcc dot gnu dot org @ 2007-05-18  5:54 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from jvdelisle at gcc dot gnu dot org  2007-05-18 06:53 -------
A patch for this bug has been submitted for approval.

http://gcc.gnu.org/ml/fortran/2007-05/msg00314.html


-- 


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


^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Bug fortran/31964] ishftc fails with certain thrid argument
  2007-05-16 22:42 [Bug fortran/31964] New: ishftc fails with certain thrid argument trumsko at yahoo dot com
                   ` (4 preceding siblings ...)
  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
                   ` (6 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: jvdelisle at gcc dot gnu dot org @ 2007-05-19  1:04 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from jvdelisle at gcc dot gnu dot org  2007-05-19 02:04 -------
Subject: Bug 31964

Author: jvdelisle
Date: Sat May 19 01:04:03 2007
New Revision: 124846

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=124846
Log:
2007-05-18  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

        PR libfortran/31964
        * intrinsics/ishftc.c (ishftc4, ishftc8, ishftc16): Fix mask to handle
        shift of bit-size number of bits.

Modified:
    trunk/libgfortran/ChangeLog
    trunk/libgfortran/intrinsics/ishftc.c


-- 


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


^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Bug fortran/31964] ishftc fails with certain thrid argument
  2007-05-16 22:42 [Bug fortran/31964] New: ishftc fails with certain thrid argument trumsko at yahoo dot com
                   ` (5 preceding siblings ...)
  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
                   ` (5 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: jvdelisle at gcc dot gnu dot org @ 2007-05-19  1:08 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from jvdelisle at gcc dot gnu dot org  2007-05-19 02:07 -------
Subject: Bug 31964

Author: jvdelisle
Date: Sat May 19 01:07:41 2007
New Revision: 124847

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=124847
Log:
2007-05-18  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

        PR libfortran/31964
        * gfortran.fortran-torture/execute/intrinsic_bitops.f90: Update.

Modified:
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/testsuite/gfortran.fortran-torture/execute/intrinsic_bitops.f90


-- 


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


^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Bug fortran/31964] [4.2, 4.1 only]ishftc fails with certain thrid argument
  2007-05-16 22:42 [Bug fortran/31964] New: ishftc fails with certain thrid argument trumsko at yahoo dot com
                   ` (6 preceding siblings ...)
  2007-05-19  1:08 ` jvdelisle at gcc dot gnu dot org
@ 2007-05-19  1:10 ` jvdelisle at gcc dot gnu dot org
  2007-05-24  5:22 ` jvdelisle at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: jvdelisle at gcc dot gnu dot org @ 2007-05-19  1:10 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #8 from jvdelisle at gcc dot gnu dot org  2007-05-19 02:10 -------
Fixed on trunk, 4.3


-- 

jvdelisle at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|ishftc fails with certain   |[4.2, 4.1 only]ishftc fails
                   |thrid argument              |with certain thrid argument
   Target Milestone|---                         |4.2.1


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


^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Bug fortran/31964] [4.2, 4.1 only]ishftc fails with certain thrid argument
  2007-05-16 22:42 [Bug fortran/31964] New: ishftc fails with certain thrid argument trumsko at yahoo dot com
                   ` (7 preceding siblings ...)
  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
                   ` (3 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: jvdelisle at gcc dot gnu dot org @ 2007-05-24  5:22 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #9 from jvdelisle at gcc dot gnu dot org  2007-05-24 06:22 -------
Subject: Bug 31964

Author: jvdelisle
Date: Thu May 24 05:22:32 2007
New Revision: 125014

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=125014
Log:
2007-05-23  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

        PR libfortran/31964
        Backport from trunk.
        * intrinsics/ishftc.c (ishftc4, ishftc8, ishftc16): Fix mask to handle
        shift of bit-size number of bits.

Modified:
    branches/gcc-4_2-branch/libgfortran/ChangeLog
    branches/gcc-4_2-branch/libgfortran/intrinsics/ishftc.c


-- 


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


^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Bug fortran/31964] [4.2, 4.1 only]ishftc fails with certain thrid argument
  2007-05-16 22:42 [Bug fortran/31964] New: ishftc fails with certain thrid argument trumsko at yahoo dot com
                   ` (8 preceding siblings ...)
  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
                   ` (2 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: jvdelisle at gcc dot gnu dot org @ 2007-05-24  5:51 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #10 from jvdelisle at gcc dot gnu dot org  2007-05-24 06:51 -------
Subject: Bug 31964

Author: jvdelisle
Date: Thu May 24 05:50:46 2007
New Revision: 125015

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=125015
Log:
2007-05-23  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

        PR libfortran/31964
        * gfortran.fortran-torture/execute/intrinsic_bitops.f90: Update.

Modified:
    branches/gcc-4_2-branch/gcc/testsuite/ChangeLog
   
branches/gcc-4_2-branch/gcc/testsuite/gfortran.fortran-torture/execute/intrinsic_bitops.f90


-- 


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


^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Bug fortran/31964] [4.2, 4.1 only]ishftc fails with certain thrid argument
  2007-05-16 22:42 [Bug fortran/31964] New: ishftc fails with certain thrid argument trumsko at yahoo dot com
                   ` (9 preceding siblings ...)
  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
  12 siblings, 0 replies; 14+ messages in thread
From: jvdelisle at gcc dot gnu dot org @ 2007-05-24  5:53 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #11 from jvdelisle at gcc dot gnu dot org  2007-05-24 06:53 -------
Subject: Bug 31964

Author: jvdelisle
Date: Thu May 24 05:53:27 2007
New Revision: 125016

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=125016
Log:
2007-05-23  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

        PR libfortran/31964
        Backport from trunk.
        * intrinsics/ishftc.c (ishftc4, ishftc8, ishftc16): Fix mask to handle
        shift of bit-size number of bits.

Modified:
    branches/gcc-4_1-branch/libgfortran/ChangeLog
    branches/gcc-4_1-branch/libgfortran/intrinsics/ishftc.c


-- 


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


^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Bug fortran/31964] [4.2, 4.1 only]ishftc fails with certain thrid argument
  2007-05-16 22:42 [Bug fortran/31964] New: ishftc fails with certain thrid argument trumsko at yahoo dot com
                   ` (10 preceding siblings ...)
  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
  12 siblings, 0 replies; 14+ messages in thread
From: jvdelisle at gcc dot gnu dot org @ 2007-05-24  5:58 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #12 from jvdelisle at gcc dot gnu dot org  2007-05-24 06:58 -------
Subject: Bug 31964

Author: jvdelisle
Date: Thu May 24 05:57:58 2007
New Revision: 125017

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=125017
Log:
2007-05-23  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

        PR libfortran/31964
        * gfortran.fortran-torture/execute/intrinsic_bitops.f90: Update.

Modified:
    branches/gcc-4_1-branch/gcc/testsuite/ChangeLog
   
branches/gcc-4_1-branch/gcc/testsuite/gfortran.fortran-torture/execute/intrinsic_bitops.f90


-- 


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


^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Bug fortran/31964] [4.2, 4.1 only]ishftc fails with certain thrid argument
  2007-05-16 22:42 [Bug fortran/31964] New: ishftc fails with certain thrid argument trumsko at yahoo dot com
                   ` (11 preceding siblings ...)
  2007-05-24  5:58 ` jvdelisle at gcc dot gnu dot org
@ 2007-05-24  5:59 ` jvdelisle at gcc dot gnu dot org
  12 siblings, 0 replies; 14+ messages in thread
From: jvdelisle at gcc dot gnu dot org @ 2007-05-24  5:59 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #13 from jvdelisle at gcc dot gnu dot org  2007-05-24 06:59 -------
Fixed on 4.2 and 4.1.  This was a regression with respect to g77.


-- 

jvdelisle at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED


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


^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2007-05-24  5:59 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-05-16 22:42 [Bug fortran/31964] New: ishftc fails with certain thrid argument 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
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

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).