public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/52111] New: [OOP] procedure pointer with polymorphic passed dummy argument
@ 2012-02-03 16:21 nagl46 at web dot de
  2012-02-03 16:22 ` [Bug fortran/52111] " nagl46 at web dot de
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: nagl46 at web dot de @ 2012-02-03 16:21 UTC (permalink / raw)
  To: gcc-bugs

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

             Bug #: 52111
           Summary: [OOP] procedure pointer with polymorphic passed dummy
                    argument
    Classification: Unclassified
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: nagl46@web.de


I declare a procedure pointer in an abstract type
>> procedure(solve_gen), pointer :: solve

with procedure interface
>> abstract interface
>>   subroutine solve_gen(this, val)
>>     import :: solverAbstract_t
>>     class(solverAbstract_t), intent(inout) :: this
>>     integer, intent(inout) :: val
>>   end subroutine
>> end interface

Class solver_t is a subclass of solverAbstract_t.
Now I want solve to point to
>>  subroutine solveLeft_sub(this, val)
>>    class(solver_t), intent(inout) :: this
>>    integer, intent(inout) :: val
>>
>>    write(*,*) 'i solve left'
>>  end subroutine

Compiling my program with this classes fails with:
>>tatanka@tippi:~/tmp$ gfortran  main.f90
>>main.f90:66.22:
>>
>>        this%solve => solveLeft_sub
>>                      1
>>Error: Interface mismatch in procedure pointer assignment at (1): Type/rank >>mismatch in argument 'this'
>>main.f90:68.22:
>>
>>        this%solve => solveRight_sub
>>                      1
>>Error: Interface mismatch in procedure pointer assignment at (1): Type/rank >>mismatch in argument 'this'
>>main.f90:74.6:
>>
>>  use m_solver
>>      1
>>Fatal Error: Can't open module file 'm_solver.mod' for reading at (1): No such >>file or directory

I found this bug in:
>>GNU Fortran (GCC) 4.7.0 20120131 (experimental)
and in
>>GNU Fortran (GCC) 4.7.0 20120120 (experimental).

In
>>GNU Fortran (Ubuntu/Linaro 4.6.1-9ubuntu3) 4.6.1
program works fine.
I also tested the bug on cray with
>>hpcatism@eslogin002:~> ftn --version
>>/opt/cray/xt-asyncpe/5.06/bin/ftn: INFO: Compiling with >>CRAYPE_COMPILE_TARGET=native.
>>/opt/cray/cce/8.0.1/cftn/x86-64/bin/ftn_driver.exe: invalid option -- '-'
On cray program also compiled fine and program works.


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

end of thread, other threads:[~2012-02-05 16:43 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-02-03 16:21 [Bug fortran/52111] New: [OOP] procedure pointer with polymorphic passed dummy argument nagl46 at web dot de
2012-02-03 16:22 ` [Bug fortran/52111] " nagl46 at web dot de
2012-02-03 17:32 ` burnus at gcc dot gnu.org
2012-02-03 17:52 ` nagl46 at web dot de
2012-02-04 11:03 ` nagl46 at web dot de
2012-02-05 16:43 ` burnus 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).