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

            Bug ID: 88412
           Summary: Associate segmentation fault assigning to derived type
           Product: gcc
           Version: 8.2.1
            Status: UNCONFIRMED
          Keywords: easyhack
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: m.diehl at mpie dot de
  Target Milestone: ---

The following program fails with a segmentation fault with 8.2.1 20181127 but
works with 8.2.1 20180831 

program derivedType                                                             
  implicit none                                                                 
  type struct                                                                   
    integer, dimension(:), allocatable :: p                                     
  end type                                                                      

  type(struct), dimension(2) :: a, b                                            

  a(1)%p = [1,2,3]                                                              
  a(2)%p = [2,3]                                                                

  associate(a1 => a(1))                                                         
    print*, 'a1',a1%p                                                           
  end associate                                                                 
  associate(a2 => a(2))                                                         
    print*, 'a2',a2%p                                                           
  end associate                                                                 

  associate(b1 => b(1))                                                         
    b1%p = [5,2,3]    ! crashes here                                            
  end associate                                                                 

  associate(b2 => b(2))                                                         
    b2%p = [5,3]                                                                
  end associate                                                                 

  print*, 'b1',b(1)%p                                                           
  print*, 'b2',b(2)%p                                                           
end program

Reply via email to