diff --git a/fortran/src/include/primes.f90 b/fortran/src/include/primes.f90 index 7648b2be..42afe91a 100644 --- a/fortran/src/include/primes.f90 +++ b/fortran/src/include/primes.f90 @@ -56,9 +56,7 @@ subroutine expand_sieve(potential_n) deallocate(prime_sieve) end if allocate(prime_sieve(new_size)) - do i = 1, new_size - prime_sieve(i) = -1 - end do + prime_sieve = -1 call clear_prime_bit(0_i18t) call clear_prime_bit(1_i18t) call sieve_up_to(new_n) diff --git a/fortran/src/include/ranges.f90 b/fortran/src/include/ranges.f90 index 3c41ad8e..93977970 100644 --- a/fortran/src/include/ranges.f90 +++ b/fortran/src/include/ranges.f90 @@ -18,6 +18,9 @@ integer function range_entry4(start, stop, step, idx) result(answer) length = 1 + (stop - 1 - start) / step elseif (step < 0 .and. start > stop) then length = 1 + (start - 1 - stop) / (-step) + else + answer = huge(kind(answer)) ! error + return end if if (l_idx < 0) then