[Bug fortran/104346] New: Problem with overloaded assignment when LHS is allocatable array
vivekrao4 at yahoo dot com
gcc-bugzilla@gcc.gnu.org
Wed Feb 2 15:47:51 GMT 2022
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104346
Bug ID: 104346
Summary: Problem with overloaded assignment when LHS is
allocatable array
Product: gcc
Version: 12.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: fortran
Assignee: unassigned at gcc dot gnu.org
Reporter: vivekrao4 at yahoo dot com
Target Milestone: ---
For the code
module assignment_mod
implicit none
interface assignment(=)
module procedure int_from_char
end interface
contains
elemental subroutine int_from_char(i,s)
integer, intent(out) :: i
character (len=*), intent(in) :: s
read (s,*) i
end subroutine int_from_char
end module assignment_mod
!
program test_assignment
use assignment_mod, only: assignment(=)
implicit none
integer :: j,k(2)
integer, allocatable :: ialloc(:)
j = "4"
print*,"j=",j
k = ["4","9"]
print*,"k=",k
ialloc = ["4","9"]
print*,"ialloc=",ialloc
end program test_assignment
compiling with GNU Fortran (GCC) 12.0.0 20211024 (experimental) from
equation.com and running gives
j= 4
k= 4 9
Program received signal SIGSEGV: Segmentation fault - invalid memory reference.
Intel Fortran also has trouble with the code:
https://community.intel.com/t5/Intel-Fortran-Compiler/Problem-with-overloaded-assignment-when-LHS-is-allocatable-array/m-p/1356724/emcs_t/S2h8ZW1haWx8dG9waWNfc3Vic2NyaXB0aW9ufEtaNVBQV1dXUDkxOTBHfDEzNTY3MjR8U1VCU0NSSVBUSU9OU3xoSw#M159809
.
More information about the Gcc-bugs
mailing list