[Bug fortran/121626] New: Problem with allocatable character (on Mac M4)
hassani at unice dot fr
gcc-bugzilla@gcc.gnu.org
Thu Aug 21 10:24:33 GMT 2025
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=121626
Bug ID: 121626
Summary: Problem with allocatable character (on Mac M4)
Product: gcc
Version: 15.1.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: fortran
Assignee: unassigned at gcc dot gnu.org
Reporter: hassani at unice dot fr
Target Milestone: ---
Dear All,
consider the following simple example:
module bar1_m
! version with module variables
implicit none
character(len=:), allocatable :: rec, kwd
contains
subroutine bar1
rec = '1234myKeyword'
kwd = rec(5:)
print*, "in bar1: rec="//rec//" kwd="//kwd
end subroutine bar1
end module bar1_m
module bar2_m
implicit none
contains
subroutine bar2
character(len=:), allocatable :: rec, kwd
rec = '1234myKeyword'
kwd = rec(5:)
print*, "in bar2: rec="//rec//" kwd="//kwd
end subroutine bar2
end module bar2_m
program foo
use bar1_m; use bar2_m
call bar1; call bar2
end program foo
When compiled with gfortran 15.1 on Mac M4 or on Mac Intel the result is not
correct for bar1 (while it was with gfortran 14.2):
$ gfortran foo.f90
$ ./a.out
in bar1: rec=1234myKeyword kwd=1234myKey
in bar2: rec=1234myKeyword kwd=myKeyword
More information about the Gcc-bugs
mailing list