Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
28441 Discussions

Silly program takes a very long time to get compiled

Arjen_Markus
Honored Contributor I
2,728 Views

At the Fortran discourse site (https://fortran-lang.discourse.group/t/computing-at-compile-time/3044/13) there is a discussion about the possibility to use compile-time computation. I wrote a small program to meet a challenge that was posted, getting a list of prime numbers at run-time. While hardly the right tool of course, for more serious purposes, it is short and it causes an amazing problem it seems for the compiler. The Intel Fortran oneAPI compiler has been running for more than 4 hours (as has the gfortran compiler).

Here is the code:

! primesieve.f90 --
!     Is it possible t obuild a prime sieve using compile-time computation?
!
program primesieve
    implicit none

    integer, parameter :: N = 1000
    integer            :: i, j
    integer, parameter :: candidates(*) = [(i, i=2,N)]
    integer, parameter :: multiples(*)  = [(( i*j, i=2,N), j=2,N)]
    integer, parameter :: primes(*)     = pack( candidates, [(all(candidates(i) /= multiples), i = 1,size(candidates))] )

    write(*,*) primes

end program primesieve

 

0 Kudos
1 Solution
Ron_Green
Moderator
2,470 Views

Bug ID CMPLRLLVM-36328


View solution in original post

0 Kudos
21 Replies
JNichols
New Contributor I
130 Views

Deleting all the partitions, make a new partition and reinstalling windows has fixed the problem. 

I sometimes wonder how many computers are out there that are not maintained and updated.  

Turning off all of the MS stuff takes almost as much time as the install.  

This site would not allow me to include a child's name, from a novel, that is the shortened form of Richard.   **Bleep** is my new go to word.  

What happens if someone has the name **Bleep** (Intel I added it for you so you do not have to).  

The gods are only human. 

**Bleep**

0 Kudos
Reply