8000 bug: segfault in `move_alloc` if target is not allocated · Issue #7400 · lfortran/lfortran · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
bug: segfault in move_alloc if target is not allocated #7400
Closed
@HarshilShah1804

Description

@HarshilShah1804

MRE

program move_alloc
  implicit none
  integer, allocatable :: a(:), b(:)

  allocate(a(3))
  a = [1, 2, 3]

  call move_alloc(a, b)
  print *, b

end program move_alloc

LFortran

(lf) harshil-shah@harshil-shah-HP-Pavilion-Laptop-15-eg2xxx:~/lfortran$ lfortran a.f90
Segmentation fault (core dumped)

GFortran

(lf) harshil-shah@harshil-shah-HP-Pavilion-Laptop-15-eg2xxx:~/lfortran$ gfortran a.f90 && ./a.out
           1           2           3

If we allocate b before calling move_alloc, then it does not segfault.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0