public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/54618] New: [OOP] wrong-code with CLASS(...), INTENT(OUT) -- and OPTIONAL or ALLOCATABLE
@ 2012-09-18 15:24 burnus at gcc dot gnu.org
  2012-09-19  8:18 ` [Bug fortran/54618] " burnus at gcc dot gnu.org
                   ` (20 more replies)
  0 siblings, 21 replies; 22+ messages in thread
From: burnus at gcc dot gnu.org @ 2012-09-18 15:24 UTC (permalink / raw)
  To: gcc-bugs

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

             Bug #: 54618
           Summary: [OOP] wrong-code with CLASS(...), INTENT(OUT) -- and
                    OPTIONAL or ALLOCATABLE
    Classification: Unclassified
           Product: gcc
           Version: 4.8.0
            Status: UNCONFIRMED
          Keywords: wrong-code
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: burnus@gcc.gnu.org
                CC: janus@gcc.gnu.org


The following program gives an ICE because one has:


f (struct __class_p_T * y)
{
  __builtin_memcpy (y->_data, y->_vptr->_def_init, y->_vptr->_size);
}


The code lacks an "if (y->_data)" check via gfc_conv_expr_present in
init_intent_out_dt.


program p
  type t
  end type t

  type(t) :: x

  call f(x)
  call f()
contains
  subroutine f(y)
    class(t), intent(out), optional :: y
  end subroutine f
end program p

* * * 

While the following program fails because there is no deallocate/memcpy in f:

f (struct __class_p_T_a & restrict y)
{

}


program p
  type t
  end type t
  type, extends(t):: t2
  end type t2

  class(t), allocatable :: x,y
  allocate (t2 :: x)
  call f(x)
  if (allocated (x) .or. .not. same_type_as (x,y)) call abort()
contains
  subroutine f(y)
    class(t), intent(out), allocatable :: y
  end subroutine f
end program p


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

end of thread, other threads:[~2013-04-05 12:29 UTC | newest]

Thread overview: 22+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-09-18 15:24 [Bug fortran/54618] New: [OOP] wrong-code with CLASS(...), INTENT(OUT) -- and OPTIONAL or ALLOCATABLE burnus at gcc dot gnu.org
2012-09-19  8:18 ` [Bug fortran/54618] " burnus at gcc dot gnu.org
2012-09-19 13:31 ` burnus at gcc dot gnu.org
2012-09-19 17:31 ` burnus at gcc dot gnu.org
2012-09-19 20:18 ` mikael at gcc dot gnu.org
2012-09-22 17:07 ` burnus at gcc dot gnu.org
2012-09-23  6:49 ` burnus at gcc dot gnu.org
2012-09-24 19:05 ` burnus at gcc dot gnu.org
2012-09-25 14:20 ` burnus at gcc dot gnu.org
2012-09-25 18:37 ` burnus at gcc dot gnu.org
2012-09-26  5:51 ` burnus at gcc dot gnu.org
2012-09-30 12:51 ` dominiq at lps dot ens.fr
2012-09-30 17:01 ` burnus at gcc dot gnu.org
2012-09-30 18:02 ` burnus at gcc dot gnu.org
2012-10-03 14:20 ` burnus at gcc dot gnu.org
2012-10-03 17:32 ` burnus at gcc dot gnu.org
2012-10-16 13:02 ` burnus at gcc dot gnu.org
2012-10-16 13:13 ` burnus at gcc dot gnu.org
2013-04-05  9:32 ` sfilippone at uniroma2 dot it
2013-04-05  9:33 ` sfilippone at uniroma2 dot it
2013-04-05 11:35 ` burnus at gcc dot gnu.org
2013-04-05 12:29 ` sfilippone at uniroma2 dot it

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).