[Bug fortran/37626] New: Internal compiler error triggered by gfortran PACK intrinsic

townsend at astro dot wisc dot edu gcc-bugzilla@gcc.gnu.org
Tue Sep 23 18:18:00 GMT 2008


The sample code below produces the following internal compiler error:

unique_A.f90: In function 'unique_a':
unique_A.f90:42: internal compiler error: Segmentation fault

The error seems to be associated with use of the PACK() intrinsic.

--CUT HERE--
function unique_A (x, sorted) result (x_unique)

  character(*), dimension(:), intent(in)       :: x
  logical, intent(in), optional                :: sorted
  character(LEN(x)), dimension(:), allocatable :: x_unique

  logical                                      :: sorted_
  character(LEN(x)), dimension(SIZE(x))        :: x_sorted
  integer                                      :: n_x
  logical, dimension(SIZE(x))                  :: mask

  integer, external                            :: b3ss_index

! Set up sorted_

  if(PRESENT(sorted)) then
     sorted_ = sorted
  else
     sorted_ = .FALSE.
  endif

! If necessary, sort x

  if(sorted_) then
     x_sorted = x
  else
     x_sorted = x(b3ss_index(x))
  endif

! Set up the unique array

  n_x = SIZE(x)

  mask = (/.TRUE.,x_sorted(2:n_x) /= x_sorted(1:n_x-1)/)

  allocate(x_unique(COUNT(mask)))

  x_unique = PACK(x_sorted, MASK=mask)

! Finish

  return

end function unique_A


-- 
           Summary: Internal compiler error triggered by gfortran PACK
                    intrinsic
           Product: gcc
           Version: 4.3.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: townsend at astro dot wisc dot edu
 GCC build triplet: x86_64-gentoo-linux
  GCC host triplet: x86_64-gentoo-linux
GCC target triplet: x86_64-gentoo-linux


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37626



More information about the Gcc-bugs mailing list