public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/57456] New: [OOP] CLASS ALLOCATE with typespec: Too little memory allocated
@ 2013-05-29 17:16 burnus at gcc dot gnu.org
  2013-05-29 17:17 ` [Bug fortran/57456] " burnus at gcc dot gnu.org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: burnus at gcc dot gnu.org @ 2013-05-29 17:16 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 57456
           Summary: [OOP] CLASS ALLOCATE with typespec: Too little memory
                    allocated
           Product: gcc
           Version: 4.9.0
            Status: UNCONFIRMED
          Keywords: wrong-code
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: burnus at gcc dot gnu.org

The following seems to ignore the typespec ("t2::") when calculating how much
memory is required to allocate:


module m
  implicit none
  type t
    integer :: i
   end type t
  type, extends(t) :: t2
    integer :: j
   end type t2
end module m

program test
  use m
  implicit none
  integer :: i
  class(t), save, allocatable :: y(:)

  allocate (t2 :: y(5)) ! Should malloc 2*4*5 = 40 bytes, mallocs only 20
  select type(y)
  type is (t2)
    do i = 1, 5
      y(i)%i = i ! "Invalid write of size 4"
    end do
  end select
  deallocate(y) ! SIGABRT: Process abort signal.
end


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

end of thread, other threads:[~2015-04-23 12:58 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-05-29 17:16 [Bug fortran/57456] New: [OOP] CLASS ALLOCATE with typespec: Too little memory allocated burnus at gcc dot gnu.org
2013-05-29 17:17 ` [Bug fortran/57456] " burnus at gcc dot gnu.org
2013-05-29 17:59 ` burnus at gcc dot gnu.org
2013-06-27 21:35 ` [Bug fortran/57456] [OOP] CLASS + CHARACTER ALLOCATE with typespec: For arrays, the typespec is ignored dominiq at lps dot ens.fr
2013-06-27 21:46 ` burnus at gcc dot gnu.org
2015-03-19 15:27 ` vehre at gcc dot gnu.org
2015-03-24 10:38 ` vehre at gcc dot gnu.org
2015-04-23 12:58 ` vehre 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).