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

            Bug ID: 77703
           Summary: ICE on assignment to pointer function
           Product: gcc
           Version: 7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: pault at gcc dot gnu.org
  Target Milestone: ---

Although related to PR68226, this code ICEs in a different place

module m

   implicit none

   private

   integer, parameter, public :: n = 2
   integer, parameter :: ell = 6

   character(len=n*ell), target, public :: s

   public :: t

contains

   function t( idx ) result( substr )

      integer, intent(in) :: idx
      !.. Function result
      character(len=ell), pointer  :: substr

      if ( (idx < 0).or.(idx > n) ) then
         error stop
      end if

      substr => s((idx-1)*ell+1:idx*ell)

      return

   end function t

end module m

program p

   use m, only : s, t, n

   integer :: i

   ! Some sections of code define 's'
   s = "123456789012"

   ! Then perform operations involving 't'
   do i = 1, n
      print *, t(i)
   end do

   ! Other sections of code define 't'
   t(1) = "Hello"
!   t(2) = "World!"

   ! Then perform operations involving 's'
   print *, s

   stop

end program p

internal compiler error: in gfc_trans_auto_character_variable, at
fortran/trans-decl.c:3763
0x6dec56 gfc_trans_auto_character_variable
        ../../trunk/gcc/fortran/trans-decl.c:3763
0x6dec56 gfc_trans_deferred_vars(gfc_symbol*, gfc_wrapped_block*)
        ../../trunk/gcc/fortran/trans-decl.c:4512
0x6e0bf3 gfc_generate_function_code(gfc_namespace*)
        ../../trunk/gcc/fortran/trans-decl.c:6362
0x66aea6 translate_all_program_units
        ../../trunk/gcc/fortran/parse.c:5936
0x66aea6 gfc_parse_file()
        ../../trunk/gcc/fortran/parse.c:6142
0x6ad472 gfc_be_parse_file
        ../../trunk/gcc/fortran/f95-lang.c:198
Please submit a full bug report,

The current version of ifort comes up with an error message to the effect that
this is an unimplemented feature.

Paul

Reply via email to