public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/41706]  New: [OOP] Calling one TBP as an actual argument of another TBP
@ 2009-10-14 13:33 janus at gcc dot gnu dot org
  2009-10-20  4:17 ` [Bug fortran/41706] " pault at gcc dot gnu dot org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: janus at gcc dot gnu dot org @ 2009-10-14 13:33 UTC (permalink / raw)
  To: gcc-bugs

Consider the following code:

module m

type :: t
contains
  procedure, nopass :: a
  procedure, nopass :: b
end type

contains

  real function a (x)
    real :: x
    a = 2.*x
  end function

  real function b (x)
    real :: x
    b = 3.*x
  end function

  subroutine s
    class(t),allocatable :: x
    real :: r
    allocate(x)
    r = x%a (1.1)       ! works
    r = x%a ( b(1.2))   ! works
    r = b ( x%a (1.3))  ! works
    r = x%a(x%b(1.4))   ! fails
  end subroutine

end


The line marked with "fails" triggers the following error (with trunk r152720):

end
   1
Internal Error at (1):
free_expr0(): Bad expr type


Backtrace:

Breakpoint 1, free_expr0 (e=0x1bd70e0) at
/home/jweil/gcc45/trunk/gcc/fortran/expr.c:209
209           gfc_internal_error ("free_expr0(): Bad expr type");
(gdb) bt
#0  free_expr0 (e=0x1bd70e0) at /home/jweil/gcc45/trunk/gcc/fortran/expr.c:209
#1  0x00000000004c54ba in gfc_free_expr (e=0x1bd70e0) at
/home/jweil/gcc45/trunk/gcc/fortran/expr.c:236
#2  0x000000000051e205 in resolve_class_compcall (e=0x1bd47f0) at
/home/jweil/gcc45/trunk/gcc/fortran/resolve.c:5237
#3  0x000000000051e6d3 in gfc_resolve_expr (e=0x1bd47f0) at
/home/jweil/gcc45/trunk/gcc/fortran/resolve.c:5391
#4  0x0000000000522405 in resolve_code (code=0x1bd5330, ns=0x1bd1ea0) at
/home/jweil/gcc45/trunk/gcc/fortran/resolve.c:7601
#5  0x000000000052b5fb in resolve_codes (ns=0x1bd1ea0) at
/home/jweil/gcc45/trunk/gcc/fortran/resolve.c:11931
#6  0x000000000052b518 in resolve_codes (ns=0x1bce0d0) at
/home/jweil/gcc45/trunk/gcc/fortran/resolve.c:11921
#7  0x000000000052b6f0 in gfc_resolve (ns=0x1bce0d0) at
/home/jweil/gcc45/trunk/gcc/fortran/resolve.c:11958
#8  0x000000000050dd80 in gfc_parse_file () at
/home/jweil/gcc45/trunk/gcc/fortran/parse.c:4195
#9  0x000000000054aaf4 in gfc_be_parse_file (set_yydebug=0) at
/home/jweil/gcc45/trunk/gcc/fortran/f95-lang.c:239
#10 0x00000000009b492d in compile_file () at
/home/jweil/gcc45/trunk/gcc/toplev.c:1049
#11 0x00000000009b6c19 in do_compile () at
/home/jweil/gcc45/trunk/gcc/toplev.c:2408
#12 0x00000000009b6cda in toplev_main (argc=2, argv=0x7fff1c893c48) at
/home/jweil/gcc45/trunk/gcc/toplev.c:2450
#13 0x00000000005c814f in main (argc=2, argv=0x7fff1c893c48) at
/home/jweil/gcc45/trunk/gcc/main.c:35


-- 
           Summary: [OOP] Calling one TBP as an actual argument of another
                    TBP
           Product: gcc
           Version: 4.5.0
            Status: UNCONFIRMED
          Keywords: ice-on-valid-code
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: janus at gcc dot gnu dot org


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


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

* [Bug fortran/41706] [OOP] Calling one TBP as an actual argument of another TBP
  2009-10-14 13:33 [Bug fortran/41706] New: [OOP] Calling one TBP as an actual argument of another TBP janus at gcc dot gnu dot org
@ 2009-10-20  4:17 ` pault at gcc dot gnu dot org
  2009-10-20  4:52 ` pault at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: pault at gcc dot gnu dot org @ 2009-10-20  4:17 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from pault at gcc dot gnu dot org  2009-10-20 04:17 -------
Subject: Bug 41706

Author: pault
Date: Tue Oct 20 04:16:02 2009
New Revision: 153004

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

        PR fortran/41706
        * resolve.c (resolve_arg_exprs): New function.
        (resolve_class_compcall): Call the above.
        (resolve_class_typebound_call): The same.

2009-10-20  Paul Thomas  <pault@gcc.gnu.org>

        PR fortran/41706
        * gfortran.dg/class_9 : New test.


Added:
    trunk/gcc/testsuite/gfortran.dg/class_9.f03
Modified:
    trunk/gcc/fortran/ChangeLog
    trunk/gcc/fortran/resolve.c
    trunk/gcc/testsuite/ChangeLog


-- 


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


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

* [Bug fortran/41706] [OOP] Calling one TBP as an actual argument of another TBP
  2009-10-14 13:33 [Bug fortran/41706] New: [OOP] Calling one TBP as an actual argument of another TBP janus at gcc dot gnu dot org
  2009-10-20  4:17 ` [Bug fortran/41706] " pault at gcc dot gnu dot org
@ 2009-10-20  4:52 ` pault at gcc dot gnu dot org
  2009-10-20 11:30 ` janus at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: pault at gcc dot gnu dot org @ 2009-10-20  4:52 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from pault at gcc dot gnu dot org  2009-10-20 04:52 -------
Fixed on trunk.

Thanks for the report!

Paul


-- 

pault at gcc dot gnu dot org changed:

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


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


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

* [Bug fortran/41706] [OOP] Calling one TBP as an actual argument of another TBP
  2009-10-14 13:33 [Bug fortran/41706] New: [OOP] Calling one TBP as an actual argument of another TBP janus at gcc dot gnu dot org
  2009-10-20  4:17 ` [Bug fortran/41706] " pault at gcc dot gnu dot org
  2009-10-20  4:52 ` pault at gcc dot gnu dot org
@ 2009-10-20 11:30 ` janus at gcc dot gnu dot org
  2009-10-20 12:19 ` paul dot richard dot thomas at gmail dot com
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: janus at gcc dot gnu dot org @ 2009-10-20 11:30 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from janus at gcc dot gnu dot org  2009-10-20 11:30 -------
Reopening. Salvatore's code still fails with the same error, which is due to
the analogous case with a subroutine:

module m

type :: t
contains
  procedure, nopass :: a
  procedure, nopass :: b
end type

contains

  subroutine a (x)
    real :: x
    print *,x
  end subroutine

  real function b ()
    b = 3.
  end function

  subroutine s
    class(t),allocatable :: x
    real :: r
    allocate(x)
    call x%a(x%b())   ! fails
  end subroutine

end


-- 

janus at gcc dot gnu dot org changed:

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


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


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

* [Bug fortran/41706] [OOP] Calling one TBP as an actual argument of another TBP
  2009-10-14 13:33 [Bug fortran/41706] New: [OOP] Calling one TBP as an actual argument of another TBP janus at gcc dot gnu dot org
                   ` (2 preceding siblings ...)
  2009-10-20 11:30 ` janus at gcc dot gnu dot org
@ 2009-10-20 12:19 ` paul dot richard dot thomas at gmail dot com
  2009-10-20 12:29 ` janus at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: paul dot richard dot thomas at gmail dot com @ 2009-10-20 12:19 UTC (permalink / raw)
  To: gcc-bugs

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 1549 bytes --]



------- Comment #4 from paul dot richard dot thomas at gmail dot com  2009-10-20 12:19 -------
Subject: Re:  [OOP] Calling one TBP as an actual argument 
        of another TBP

Oh bother!  I completely forgot to test the subroutine branch - thanks Janus

On Tue, Oct 20, 2009 at 1:30 PM, janus at gcc dot gnu dot org
<gcc-bugzilla@gcc.gnu.org> wrote:
>
>
> ------- Comment #3 from janus at gcc dot gnu dot org  2009-10-20 11:30 -------
> Reopening. Salvatore's code still fails with the same error, which is due to
> the analogous case with a subroutine:
>
> module m
>
> type :: t
> contains
>  procedure, nopass :: a
>  procedure, nopass :: b
> end type
>
> contains
>
>  subroutine a (x)
>    real :: x
>    print *,x
>  end subroutine
>
>  real function b ()
>    b = 3.
>  end function
>
>  subroutine s
>    class(t),allocatable :: x
>    real :: r
>    allocate(x)
>    call x%a(x%b())   ! fails
>  end subroutine
>
> end
>
>
> --
>
> janus at gcc dot gnu dot org changed:
>
>           What    |Removed                     |Added
> ----------------------------------------------------------------------------
>             Status|RESOLVED                    |UNCONFIRMED
>         Resolution|FIXED                       |
>
>
> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41706
>
> ------- You are receiving this mail because: -------
> You are on the CC list for the bug, or are watching someone who is.
>


-- 


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


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

* [Bug fortran/41706] [OOP] Calling one TBP as an actual argument of another TBP
  2009-10-14 13:33 [Bug fortran/41706] New: [OOP] Calling one TBP as an actual argument of another TBP janus at gcc dot gnu dot org
                   ` (3 preceding siblings ...)
  2009-10-20 12:19 ` paul dot richard dot thomas at gmail dot com
@ 2009-10-20 12:29 ` janus at gcc dot gnu dot org
  2009-10-21  8:57 ` janus at gcc dot gnu dot org
  2009-10-21  9:01 ` janus at gcc dot gnu dot org
  6 siblings, 0 replies; 8+ messages in thread
From: janus at gcc dot gnu dot org @ 2009-10-20 12:29 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from janus at gcc dot gnu dot org  2009-10-20 12:29 -------
(In reply to comment #4)
> Oh bother!  I completely forgot to test the subroutine branch - thanks Janus

But in your patch you do the argument resolution both in resolve_class_compcall
and resolve_class_typebound_call, which should take care of type-bound
functions *and* subroutines, shouldn't it? Therefore I don't see why it still
fails for subroutines ...


-- 


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


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

* [Bug fortran/41706] [OOP] Calling one TBP as an actual argument of another TBP
  2009-10-14 13:33 [Bug fortran/41706] New: [OOP] Calling one TBP as an actual argument of another TBP janus at gcc dot gnu dot org
                   ` (4 preceding siblings ...)
  2009-10-20 12:29 ` janus at gcc dot gnu dot org
@ 2009-10-21  8:57 ` janus at gcc dot gnu dot org
  2009-10-21  9:01 ` janus at gcc dot gnu dot org
  6 siblings, 0 replies; 8+ messages in thread
From: janus at gcc dot gnu dot org @ 2009-10-21  8:57 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from janus at gcc dot gnu dot org  2009-10-21 08:57 -------
Subject: Bug 41706

Author: janus
Date: Wed Oct 21 08:56:56 2009
New Revision: 153049

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=153049
Log:
2009-10-21  Janus Weil  <janus@gcc.gnu.org>

        PR fortran/41706
        PR fortran/41766
        * match.c (select_type_set_tmp): Set flavor for temporary.
        * resolve.c (resolve_class_typebound_call): Correctly resolve actual
        arguments.


2009-10-21  Janus Weil  <janus@gcc.gnu.org>

        PR fortran/41706
        PR fortran/41766
        * gfortran.dg/class_9.f03: Extended test case.
        * gfortran.dg/select_type_7.f03: New test case.

Added:
    trunk/gcc/testsuite/gfortran.dg/select_type_7.f03
Modified:
    trunk/gcc/fortran/ChangeLog
    trunk/gcc/fortran/match.c
    trunk/gcc/fortran/resolve.c
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/testsuite/gfortran.dg/class_9.f03


-- 


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


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

* [Bug fortran/41706] [OOP] Calling one TBP as an actual argument of another TBP
  2009-10-14 13:33 [Bug fortran/41706] New: [OOP] Calling one TBP as an actual argument of another TBP janus at gcc dot gnu dot org
                   ` (5 preceding siblings ...)
  2009-10-21  8:57 ` janus at gcc dot gnu dot org
@ 2009-10-21  9:01 ` janus at gcc dot gnu dot org
  6 siblings, 0 replies; 8+ messages in thread
From: janus at gcc dot gnu dot org @ 2009-10-21  9:01 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from janus at gcc dot gnu dot org  2009-10-21 09:01 -------
Fixed with r153049. Closing.


-- 

janus at gcc dot gnu dot org changed:

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


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


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

end of thread, other threads:[~2009-10-21  9:01 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-10-14 13:33 [Bug fortran/41706] New: [OOP] Calling one TBP as an actual argument of another TBP janus at gcc dot gnu dot org
2009-10-20  4:17 ` [Bug fortran/41706] " pault at gcc dot gnu dot org
2009-10-20  4:52 ` pault at gcc dot gnu dot org
2009-10-20 11:30 ` janus at gcc dot gnu dot org
2009-10-20 12:19 ` paul dot richard dot thomas at gmail dot com
2009-10-20 12:29 ` janus at gcc dot gnu dot org
2009-10-21  8:57 ` janus at gcc dot gnu dot org
2009-10-21  9:01 ` janus 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).