public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/42207]  New: Compile-time errors on typed allocation and pointer function result assignment
@ 2009-11-28 18:14 damian at rouson dot net
  2009-11-28 18:25 ` [Bug fortran/42207] " sfilippone at uniroma2 dot it
                   ` (20 more replies)
  0 siblings, 21 replies; 22+ messages in thread
From: damian at rouson dot net @ 2009-11-28 18:14 UTC (permalink / raw)
  To: gcc-bugs

After a fresh fortran-dev checkout, configure, make, and make install, the
first two modules below compile correctly, while the third produces the the
compile-time errors shown.  The two offending lines are the "allocate"
statement and the subsequent pointer assignment, both in the "new_bar"
function.  Based on the error message, this is related to vtabs.  Apparently
the error is platform-dependent since Janus reports compiling similar code with
no problem.

Damian

$ cat foo.f03 
module foo_module
  implicit none
  type foo 
  end type
end module

$ cat bar.f03 
module bar_module
  use foo_module
  implicit none
  type ,extends(foo) :: bar
  end type
contains
  function bar_()
    type(bar) ,pointer :: bar_ 
    bar_ => null()
  end function
end module

$ cat bar_factory.f03 
module bar_factory_module
  implicit none
  type bar_factory
  contains 
    procedure :: new_bar
  end type 
contains
  function new_bar(this) 
    use bar_module
    use foo_module 
    class(bar_factory), intent(in) :: this
    class(foo) ,pointer :: new_bar
    allocate(bar :: new_bar)
    new_bar => bar_() 
  end function
end module

$ gfortran -c foo.f03
$ gfortran -c bar.f03
$ gfortran -c bar_factory.f03 
/var/folders/aN/aNwnamXwF00CoxUk5fEVmU+++TM/-Tmp-//cciAcMyX.s:37:non-relocatable
subtraction expression, "_vtab$bar.1525" minus "L00000000001$pb"
/var/folders/aN/aNwnamXwF00CoxUk5fEVmU+++TM/-Tmp-//cciAcMyX.s:37:symbol:
"_vtab$bar.1525" can't be undefined in a subtraction expression
/var/folders/aN/aNwnamXwF00CoxUk5fEVmU+++TM/-Tmp-//cciAcMyX.s:35:non-relocatable
subtraction expression, "_vtab$bar.1525" minus "L00000000001$pb"
/var/folders/aN/aNwnamXwF00CoxUk5fEVmU+++TM/-Tmp-//cciAcMyX.s:35:symbol:
"_vtab$bar.1525" can't be undefined in a subtraction expression


-- 
           Summary: Compile-time errors on typed allocation and pointer
                    function result assignment
           Product: gcc
           Version: 4.5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: damian at rouson dot net
 GCC build triplet: Mac OS X 10.5.8
  GCC host triplet: Mac OS X 10.5.8
GCC target triplet: Mac OS X 10.5.8


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


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

end of thread, other threads:[~2010-08-04 20:01 UTC | newest]

Thread overview: 22+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-11-28 18:14 [Bug fortran/42207] New: Compile-time errors on typed allocation and pointer function result assignment damian at rouson dot net
2009-11-28 18:25 ` [Bug fortran/42207] " sfilippone at uniroma2 dot it
2009-11-28 20:18 ` dominiq at lps dot ens dot fr
2009-11-29  2:50 ` damian at rouson dot net
2009-11-29 12:31 ` [Bug fortran/42207] [OOP] " janus at gcc dot gnu dot org
2009-11-29 16:22 ` dominiq at lps dot ens dot fr
2009-11-30  0:52 ` damian at rouson dot net
2009-11-30  1:16 ` damian at rouson dot net
2010-08-03 10:03 ` burnus at gcc dot gnu dot org
2010-08-03 11:36 ` janus at gcc dot gnu dot org
2010-08-03 11:49 ` dominiq at lps dot ens dot fr
2010-08-03 11:51 ` burnus at gcc dot gnu dot org
2010-08-03 12:59 ` janus at gcc dot gnu dot org
2010-08-03 13:43 ` dominiq at lps dot ens dot fr
2010-08-03 14:31 ` mikael at gcc dot gnu dot org
2010-08-03 15:31 ` dominiq at lps dot ens dot fr
2010-08-03 16:32 ` janus at gcc dot gnu dot org
2010-08-03 18:08 ` dominiq at lps dot ens dot fr
2010-08-03 18:55 ` dominiq at lps dot ens dot fr
2010-08-04  7:31 ` janus at gcc dot gnu dot org
2010-08-04 19:49 ` janus at gcc dot gnu dot org
2010-08-04 20: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).