public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/105478] New: malloc error abort when using -fstack-arrays
@ 2022-05-04 11:27 m.a.hulsen at tue dot nl
  2022-05-04 12:10 ` [Bug fortran/105478] " marxin at gcc dot gnu.org
  0 siblings, 1 reply; 2+ messages in thread
From: m.a.hulsen at tue dot nl @ 2022-05-04 11:27 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105478

            Bug ID: 105478
           Summary: malloc error abort when using -fstack-arrays
           Product: gcc
           Version: 11.3.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: m.a.hulsen at tue dot nl
  Target Milestone: ---

The code below gives

a.out(78480,0x10ea3f600) malloc: *** error for object 0x7ff8800a8000: pointer
being freed was not allocated
a.out(78480,0x10ea3f600) malloc: *** set a breakpoint in malloc_error_break to
debug

Program received signal SIGABRT: Process abort signal.

when compiled and build with "gfortran -fstack-arrays".

Code:

module mesh_m
  implicit none
  type element_t
    integer, allocatable, dimension(:,:) :: sidvert
  end type element_t
  type geometry_t
    type(element_t) :: element
  end type geometry_t
  type mesh_t
    type(geometry_t), allocatable, dimension(:) :: curves
  end type mesh_t
contains
  subroutine copy_element_basic ( element1, element )
    type(element_t), intent(in) :: element1
    type(element_t), intent(out) :: element
  end subroutine copy_element_basic
  subroutine copy_element_array_basic ( element1, element )
    type(element_t), dimension(:), intent(in) :: element1
    type(element_t), dimension(:), intent(out) :: element
    integer :: i
    do i = 1, size(element1)
      call copy_element_basic ( element1(i), element(i) )
    end do
  end subroutine copy_element_array_basic
end module mesh_m
program bug
  use mesh_m
  type(mesh_t) :: mesh1, mesh
  allocate(mesh1%curves(4))
  allocate(mesh%curves(4))
  call copy_element_array_basic ( mesh1%curves(:)%element, &
                                  mesh%curves(:)%element )
end program bug

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

* [Bug fortran/105478] malloc error abort when using -fstack-arrays
  2022-05-04 11:27 [Bug fortran/105478] New: malloc error abort when using -fstack-arrays m.a.hulsen at tue dot nl
@ 2022-05-04 12:10 ` marxin at gcc dot gnu.org
  0 siblings, 0 replies; 2+ messages in thread
From: marxin at gcc dot gnu.org @ 2022-05-04 12:10 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105478

Martin Liška <marxin at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
   Last reconfirmed|                            |2022-05-04
             Status|UNCONFIRMED                 |NEW
                 CC|                            |marxin at gcc dot gnu.org

--- Comment #1 from Martin Liška <marxin at gcc dot gnu.org> ---
I see the crash even w/o -fstack-arrays for all compilers I have (4.9.0+).

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

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

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-04 11:27 [Bug fortran/105478] New: malloc error abort when using -fstack-arrays m.a.hulsen at tue dot nl
2022-05-04 12:10 ` [Bug fortran/105478] " marxin 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).