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

Dominique d'Humieres <dominiq at lps dot ens.fr> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |pault at gcc dot gnu.org

--- Comment #4 from Dominique d'Humieres <dominiq at lps dot ens.fr> ---
> I'd also appreciate a short workaround.

  subroutine selector_init (selector, weight)
    real :: s
    integer :: n, i
    logical, dimension(:), allocatable :: mask
    integer, allocatable :: tmpi(:)
    real, allocatable :: tmpr(:)
    s = sum (weight)
    allocate (mask (size (weight)), source = weight /= 0)
    n = count (mask)
    if (n > 0) then
        allocate(tmpi(n),tmpr(n))
        tmpi = pack ([(i, i = 1, size (weight))], mask)
        tmpr = pack (weight / s, mask)
        allocate (selector%map (n), source = tmpi)
        allocate (selector%weight (n), source = tmpr)
    else
       allocate (selector%map (1), source = 1)
       allocate (selector%weight (1), source = 0.)
    end if
  end subroutine selector_init

Reply via email to