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

Reply via email to