public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/32689]  New: [4.3 regression] with SIZE or TRANSFER
@ 2007-07-09  7:52 anlauf at gmx dot de
  2007-07-09  9:10 ` [Bug fortran/32689] [4.3 regression] TRANSFER returns scalar, even if MOLD is an array dfranke at gcc dot gnu dot org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: anlauf at gmx dot de @ 2007-07-09  7:52 UTC (permalink / raw)
  To: gcc-bugs

Hi,

the following snippet

program gfcbug67
  implicit none

  type mytype
     integer, pointer :: i(:) => NULL ()
  end type mytype
  type(mytype) :: t

  print *, size (transfer (1, t% i))
end program gfcbug67

fails to compile with:

gfcbug67.f90:9.17:

  print *, size (transfer (1, t% i))
                1
Error: 'array' argument of 'size' intrinsic at (1) must be an array


Cheers,
-ha


-- 
           Summary: [4.3 regression] with SIZE or TRANSFER
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: anlauf at gmx dot de
  GCC host triplet: i686-pc-linux-gnu


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


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

* [Bug fortran/32689] [4.3 regression] TRANSFER returns scalar, even if MOLD is an array
  2007-07-09  7:52 [Bug fortran/32689] New: [4.3 regression] with SIZE or TRANSFER anlauf at gmx dot de
@ 2007-07-09  9:10 ` dfranke at gcc dot gnu dot org
  2007-07-09 21:33 ` pault at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: dfranke at gcc dot gnu dot org @ 2007-07-09  9:10 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from dfranke at gcc dot gnu dot org  2007-07-09 09:10 -------
>From docs:

RESULT = TRANSFER(SOURCE, MOLD[, SIZE]) 

The result has the same type as MOLD, with the bit level representation of
SOURCE. If SIZE is present, the result is a one-dimensional array of length
SIZE. If SIZE is absent but MOLD is an array (of any size or shape), the result
is a one- dimensional array of the minimum length needed to contain the
entirety of the bitwise representation of SOURCE. If SIZE is absent and MOLD is
a scalar, the result is a scalar.

Obviously, in this case TRANSFER does not return an "one- dimensional array of
the minimum length" but a scalar.

Reduced testcase:
$> cat pr32689.f90
program gfcbug67
  integer :: i(3)
  print *, size (transfer (1, i))
end program gfcbug67


-- 

dfranke at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |dfranke at gcc dot gnu dot
                   |                            |org
OtherBugsDependingO|                            |31237
              nThis|                            |
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
   GCC host triplet|i686-pc-linux-gnu           |
      Known to fail|                            |4.3.0
      Known to work|                            |4.2.1
   Last reconfirmed|0000-00-00 00:00:00         |2007-07-09 09:10:41
               date|                            |
            Summary|[4.3 regression] with SIZE  |[4.3 regression] TRANSFER
                   |or TRANSFER                 |returns scalar, even if MOLD
                   |                            |is an array


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


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

* [Bug fortran/32689] [4.3 regression] TRANSFER returns scalar, even if MOLD is an array
  2007-07-09  7:52 [Bug fortran/32689] New: [4.3 regression] with SIZE or TRANSFER anlauf at gmx dot de
  2007-07-09  9:10 ` [Bug fortran/32689] [4.3 regression] TRANSFER returns scalar, even if MOLD is an array dfranke at gcc dot gnu dot org
@ 2007-07-09 21:33 ` pault at gcc dot gnu dot org
  2007-07-10  5:11 ` pault at gcc dot gnu dot org
  2007-07-10  5:12 ` pault at gcc dot gnu dot org
  3 siblings, 0 replies; 5+ messages in thread
From: pault at gcc dot gnu dot org @ 2007-07-09 21:33 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from pault at gcc dot gnu dot org  2007-07-09 21:33 -------
(In reply to comment #1)

How wierd and wonderful - whilst it is a regression, it is only just; given the
timing of gfc_array_transfer and gfc_simplify_transfer, the latter undid the
former by only a few months or so:)

Really galling is that Brooks and I missed this case and that the fix is so
very easy *sigh*

Index: gcc/fortran/simplify.c
===================================================================
*** gcc/fortran/simplify.c      (revision 126461)
--- gcc/fortran/simplify.c      (working copy)
*************** gfc_simplify_transfer (gfc_expr *source,
*** 3924,3930 ****

    /* Set the number of elements in the result, and determine its size.  */
    result_elt_size = gfc_target_expr_size (mold_element);
!   if (mold->expr_type == EXPR_ARRAY || size)
      {
        int result_length;

--- 3924,3930 ----

    /* Set the number of elements in the result, and determine its size.  */
    result_elt_size = gfc_target_expr_size (mold_element);
!   if (mold->expr_type == EXPR_ARRAY || mold->rank || size)
      {
        int result_length;

I will commit this tomorrow morning, with two other "obvious" patches, after
regtesting.

Paul


-- 

pault at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |pault at gcc dot gnu dot org
                   |dot org                     |
             Status|NEW                         |ASSIGNED
   Last reconfirmed|2007-07-09 09:10:41         |2007-07-09 21:33:26
               date|                            |


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


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

* [Bug fortran/32689] [4.3 regression] TRANSFER returns scalar, even if MOLD is an array
  2007-07-09  7:52 [Bug fortran/32689] New: [4.3 regression] with SIZE or TRANSFER anlauf at gmx dot de
  2007-07-09  9:10 ` [Bug fortran/32689] [4.3 regression] TRANSFER returns scalar, even if MOLD is an array dfranke at gcc dot gnu dot org
  2007-07-09 21:33 ` pault at gcc dot gnu dot org
@ 2007-07-10  5:11 ` pault at gcc dot gnu dot org
  2007-07-10  5:12 ` pault at gcc dot gnu dot org
  3 siblings, 0 replies; 5+ messages in thread
From: pault at gcc dot gnu dot org @ 2007-07-10  5:11 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from pault at gcc dot gnu dot org  2007-07-10 05:11 -------
Subject: Bug 32689

Author: pault
Date: Tue Jul 10 05:11:00 2007
New Revision: 126509

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=126509
Log:
2007-07-10  Paul Thomas  <pault@gcc.gnu.org>

        PR fortran/32157
        * resolve.c (is_external_proc): New function.  Adds test that
        the symbol is not an intrinsic procedure.
        * (resolve_function, resolve_call): Replace logical statements
        with call to is_external_proc.

        PR fortran/32689
        * simplify.c (gfc_simplify_transfer): If mold has rank, the
        result is an array.

        PR fortran/32634
        * module.c (write_generic): Write the local name of the
        interface. 


2007-07-10  Paul Thomas  <pault@gcc.gnu.org>

        PR fortran/32157
        * gfortran.dg/overload_2.f90: New test.

        PR fortran/32689
        * gfortran.dg/transfer_simplify_5.f90

        PR fortran/32634
        * gfortran.dg/interface_15.f90: New test.

Added:
    trunk/gcc/testsuite/gfortran.dg/interface_16.f90
    trunk/gcc/testsuite/gfortran.dg/overload_2.f90
    trunk/gcc/testsuite/gfortran.dg/transfer_simplify_5.f90
Modified:
    trunk/gcc/fortran/ChangeLog
    trunk/gcc/fortran/module.c
    trunk/gcc/fortran/resolve.c
    trunk/gcc/fortran/simplify.c
    trunk/gcc/testsuite/ChangeLog


-- 


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


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

* [Bug fortran/32689] [4.3 regression] TRANSFER returns scalar, even if MOLD is an array
  2007-07-09  7:52 [Bug fortran/32689] New: [4.3 regression] with SIZE or TRANSFER anlauf at gmx dot de
                   ` (2 preceding siblings ...)
  2007-07-10  5:11 ` pault at gcc dot gnu dot org
@ 2007-07-10  5:12 ` pault at gcc dot gnu dot org
  3 siblings, 0 replies; 5+ messages in thread
From: pault at gcc dot gnu dot org @ 2007-07-10  5:12 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from pault at gcc dot gnu dot org  2007-07-10 05:12 -------
Fixed

Paul


-- 

pault at gcc dot gnu dot org changed:

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


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


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

end of thread, other threads:[~2007-07-10  5:12 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-07-09  7:52 [Bug fortran/32689] New: [4.3 regression] with SIZE or TRANSFER anlauf at gmx dot de
2007-07-09  9:10 ` [Bug fortran/32689] [4.3 regression] TRANSFER returns scalar, even if MOLD is an array dfranke at gcc dot gnu dot org
2007-07-09 21:33 ` pault at gcc dot gnu dot org
2007-07-10  5:11 ` pault at gcc dot gnu dot org
2007-07-10  5:12 ` pault 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).