public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/59251] New: wrong code generation with allocatable dummy argument and INTENT(OUT)
@ 2013-11-22 13:59 arnaud02 at users dot sourceforge.net
  2013-11-22 14:19 ` [Bug fortran/59251] " dominiq at lps dot ens.fr
  2014-01-04 17:10 ` janus at gcc dot gnu.org
  0 siblings, 2 replies; 3+ messages in thread
From: arnaud02 at users dot sourceforge.net @ 2013-11-22 13:59 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 59251
           Summary: wrong code generation with allocatable dummy argument
                    and INTENT(OUT)
           Product: gcc
           Version: 4.8.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: arnaud02 at users dot sourceforge.net

Using the following program:

module branch_plot_results_mod
  implicit none

  type, public :: system_variable_type
     sequence
     integer :: index = -1
  end type system_variable_type

  type branch_plot_results_type
     sequence
     integer                                 :: iu_appv = 0
     type(system_variable_type), allocatable :: system_variables(:)

  end type branch_plot_results_type
contains
  subroutine  make1 ( res)
    type(branch_plot_results_type), allocatable, intent(out) :: res !
"intent(out)" causes wrong code generation
  end subroutine make1
end module branch_plot_results_mod

program testy
  use branch_plot_results_mod
  type(branch_plot_results_type), allocatable :: res1
  call make1(res1)
end program testy

gfortran 4.8.2 on Linux x86_64 produces an executable that crashes due to a
memory corruption.
valgrind reports:
==24704== Invalid free() / delete / delete[] / realloc()
==24704==    at 0x4A071A4: free (vg_replace_malloc.c:468)
==24704==    by 0x401B25: __branch_plot_results_mod_MOD_make1 (b1.f90:16)
==24704==    by 0x401BA3: MAIN__ (b1.f90:24)
==24704==    by 0x401C21: main (b1.f90:22)
==24704==  Address 0xffefffaa0 is on thread 1's stack

This is related to the use of the INTENT(OUT). This report is a possible
duplicate of PR56218 although the program above does not use any OOP feature.


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

end of thread, other threads:[~2014-01-04 17:10 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-11-22 13:59 [Bug fortran/59251] New: wrong code generation with allocatable dummy argument and INTENT(OUT) arnaud02 at users dot sourceforge.net
2013-11-22 14:19 ` [Bug fortran/59251] " dominiq at lps dot ens.fr
2014-01-04 17:10 ` janus 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).