public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/59143] New: Problem with array dimension in polymorphic types
@ 2013-11-15  3:49 juergen.reuter at desy dot de
  2013-11-15  3:49 ` [Bug fortran/59143] " juergen.reuter at desy dot de
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: juergen.reuter at desy dot de @ 2013-11-15  3:49 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 59143
           Summary: Problem with array dimension in polymorphic types
           Product: gcc
           Version: 4.9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: juergen.reuter at desy dot de

The following code produces a warning, but is valid code:

gfortran  -c phs_single.f90
phs_single.f90:14.16:

    call func1 (phs%decay_p ())
                1
Warning: Actual argument contains too few elements for dummy argument 'p' (1/2)
at (1)

The code is:

module phs_single
  type :: phs_single_t
     real, dimension(:), allocatable :: p
   contains
     procedure :: evaluate
     procedure :: decay_p 
  end type phs_single_t

contains

  subroutine evaluate (phs)
    class(phs_single_t), intent(inout) :: phs
    call func1 (phs%decay_p ())
  end subroutine evaluate

  subroutine func1 (p)
    real, dimension(2), intent(in) :: p
    print *, p
  end subroutine func1

  function decay_p (phs) result (p)
    class(phs_single_t), intent(in) :: phs
    real, dimension(2) :: p
    p(1) = 1.
    p(2) = 5.
  end function decay_p

end module phs_single


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

* [Bug fortran/59143] Problem with array dimension in polymorphic types
  2013-11-15  3:49 [Bug fortran/59143] New: Problem with array dimension in polymorphic types juergen.reuter at desy dot de
@ 2013-11-15  3:49 ` juergen.reuter at desy dot de
  2013-11-15 20:38 ` [Bug fortran/59143] [OOP] Bogus warning with array-valued type-bound procedure janus at gcc dot gnu.org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: juergen.reuter at desy dot de @ 2013-11-15  3:49 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Jürgen Reuter <juergen.reuter at desy dot de> ---
The problem is back in 4.8, 4.7, 4.6.
>From gcc-bugs-return-434659-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Fri Nov 15 06:19:28 2013
Return-Path: <gcc-bugs-return-434659-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 11140 invoked by alias); 15 Nov 2013 06:19:27 -0000
Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm
Precedence: bulk
List-Id: <gcc-bugs.gcc.gnu.org>
List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/>
List-Post: <mailto:gcc-bugs@gcc.gnu.org>
List-Help: <mailto:gcc-bugs-help@gcc.gnu.org>
Sender: gcc-bugs-owner@gcc.gnu.org
Delivered-To: mailing list gcc-bugs@gcc.gnu.org
Received: (qmail 11102 invoked by uid 48); 15 Nov 2013 06:19:23 -0000
From: "d.v.a at ngs dot ru" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug libstdc++/28811] --with-pic vs static libraries and libstdc++
Date: Fri, 15 Nov 2013 06:19:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: libstdc++
X-Bugzilla-Version: 4.1.2
X-Bugzilla-Keywords: link-failure
X-Bugzilla-Severity: normal
X-Bugzilla-Who: d.v.a at ngs dot ru
X-Bugzilla-Status: ASSIGNED
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: bkoz at gcc dot gnu.org
X-Bugzilla-Target-Milestone: ---
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields:
Message-ID: <bug-28811-4-aC4j6VTcBw@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-28811-4@http.gcc.gnu.org/bugzilla/>
References: <bug-28811-4@http.gcc.gnu.org/bugzilla/>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: 7bit
X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/
Auto-Submitted: auto-generated
MIME-Version: 1.0
X-SW-Source: 2013-11/txt/msg01436.txt.bz2
Content-length: 166

http://gcc.gnu.org/bugzilla/show_bug.cgi?id(811

--- Comment #23 from __vic <d.v.a at ngs dot ru> ---
What actual status of this bug is? Is it fixed or still not?


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

* [Bug fortran/59143] [OOP] Bogus warning with array-valued type-bound procedure
  2013-11-15  3:49 [Bug fortran/59143] New: Problem with array dimension in polymorphic types juergen.reuter at desy dot de
  2013-11-15  3:49 ` [Bug fortran/59143] " juergen.reuter at desy dot de
@ 2013-11-15 20:38 ` janus at gcc dot gnu.org
  2013-11-15 21:56 ` janus at gcc dot gnu.org
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: janus at gcc dot gnu.org @ 2013-11-15 20:38 UTC (permalink / raw)
  To: gcc-bugs

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

janus at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |diagnostic
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2013-11-15
                 CC|                            |janus at gcc dot gnu.org
            Summary|Problem with array          |[OOP] Bogus warning with
                   |dimension in polymorphic    |array-valued type-bound
                   |types                       |procedure
     Ever confirmed|0                           |1

--- Comment #2 from janus at gcc dot gnu.org ---
Confirmed. Slightly reduced version:


module phs_single

  type :: phs_single_t
   contains
     procedure, nopass :: decay_p 
  end type

contains

  subroutine evaluate (phs)
    class(phs_single_t) :: phs
    call func1 (phs%decay_p ())
  end subroutine

  subroutine func1 (p)
    real :: p(2)
  end subroutine

  function decay_p ()
    real :: decay_p(2)
    decay_p = 1.
  end function

end module


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

* [Bug fortran/59143] [OOP] Bogus warning with array-valued type-bound procedure
  2013-11-15  3:49 [Bug fortran/59143] New: Problem with array dimension in polymorphic types juergen.reuter at desy dot de
  2013-11-15  3:49 ` [Bug fortran/59143] " juergen.reuter at desy dot de
  2013-11-15 20:38 ` [Bug fortran/59143] [OOP] Bogus warning with array-valued type-bound procedure janus at gcc dot gnu.org
@ 2013-11-15 21:56 ` janus at gcc dot gnu.org
  2013-11-16 10:23 ` janus at gcc dot gnu.org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: janus at gcc dot gnu.org @ 2013-11-15 21:56 UTC (permalink / raw)
  To: gcc-bugs

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

janus at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
           Assignee|unassigned at gcc dot gnu.org      |janus at gcc dot gnu.org

--- Comment #3 from janus at gcc dot gnu.org ---
Early draft patch (fixes the test case but is not regtested yet):


Index: gcc/fortran/interface.c
===================================================================
--- gcc/fortran/interface.c    (revision 204778)
+++ gcc/fortran/interface.c    (working copy)
@@ -2426,6 +2426,17 @@ get_expr_storage_size (gfc_expr *e)
             - mpz_get_si (ref->u.ar.as->lower[i]->value.integer));
         }
         }
+      else if (ref->type == REF_COMPONENT && ref->u.c.component->attr.function
+           && ref->u.c.component->attr.proc_pointer
+           && ref->u.c.component->attr.dimension)
+    {
+      /* Array-valued procedure-pointer components.  */
+      gfc_array_spec *as = ref->u.c.component->as;
+      for (i = 0; i < as->rank; i++)
+        elements = elements
+              * (mpz_get_si (as->upper[i]->value.integer)
+              - mpz_get_si (as->lower[i]->value.integer) + 1L);
+    }
     }

   if (substrlen)


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

* [Bug fortran/59143] [OOP] Bogus warning with array-valued type-bound procedure
  2013-11-15  3:49 [Bug fortran/59143] New: Problem with array dimension in polymorphic types juergen.reuter at desy dot de
                   ` (2 preceding siblings ...)
  2013-11-15 21:56 ` janus at gcc dot gnu.org
@ 2013-11-16 10:23 ` janus at gcc dot gnu.org
  2013-11-25  9:45 ` janus at gcc dot gnu.org
  2013-11-25  9:51 ` janus at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: janus at gcc dot gnu.org @ 2013-11-16 10:23 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from janus at gcc dot gnu.org ---
(In reply to janus from comment #3)
> Early draft patch (fixes the test case but is not regtested yet):

Regtests cleanly.


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

* [Bug fortran/59143] [OOP] Bogus warning with array-valued type-bound procedure
  2013-11-15  3:49 [Bug fortran/59143] New: Problem with array dimension in polymorphic types juergen.reuter at desy dot de
                   ` (3 preceding siblings ...)
  2013-11-16 10:23 ` janus at gcc dot gnu.org
@ 2013-11-25  9:45 ` janus at gcc dot gnu.org
  2013-11-25  9:51 ` janus at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: janus at gcc dot gnu.org @ 2013-11-25  9:45 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from janus at gcc dot gnu.org ---
Author: janus
Date: Mon Nov 25 09:45:40 2013
New Revision: 205345

URL: http://gcc.gnu.org/viewcvs?rev=205345&root=gcc&view=rev
Log:
2013-11-25  Janus Weil  <janus@gcc.gnu.org>

    PR fortran/59143
    * interface.c (get_expr_storage_size): Handle array-valued type-bound
    procedures.

2013-11-25  Janus Weil  <janus@gcc.gnu.org>

    PR fortran/59143
    * gfortran.dg/typebound_proc_30.f90: New.

Added:
    trunk/gcc/testsuite/gfortran.dg/typebound_proc_30.f90
Modified:
    trunk/gcc/fortran/ChangeLog
    trunk/gcc/fortran/interface.c
    trunk/gcc/testsuite/ChangeLog


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

* [Bug fortran/59143] [OOP] Bogus warning with array-valued type-bound procedure
  2013-11-15  3:49 [Bug fortran/59143] New: Problem with array dimension in polymorphic types juergen.reuter at desy dot de
                   ` (4 preceding siblings ...)
  2013-11-25  9:45 ` janus at gcc dot gnu.org
@ 2013-11-25  9:51 ` janus at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: janus at gcc dot gnu.org @ 2013-11-25  9:51 UTC (permalink / raw)
  To: gcc-bugs

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

janus at gcc dot gnu.org changed:

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

--- Comment #6 from janus at gcc dot gnu.org ---
Fixed with r205345. Closing.

Thanks for the report!


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

end of thread, other threads:[~2013-11-25  9:51 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-11-15  3:49 [Bug fortran/59143] New: Problem with array dimension in polymorphic types juergen.reuter at desy dot de
2013-11-15  3:49 ` [Bug fortran/59143] " juergen.reuter at desy dot de
2013-11-15 20:38 ` [Bug fortran/59143] [OOP] Bogus warning with array-valued type-bound procedure janus at gcc dot gnu.org
2013-11-15 21:56 ` janus at gcc dot gnu.org
2013-11-16 10:23 ` janus at gcc dot gnu.org
2013-11-25  9:45 ` janus at gcc dot gnu.org
2013-11-25  9:51 ` janus at gcc dot gnu.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).