I'm working on a code to compute the Kahan summation of two arrays. I'm a bit new to fortran so my error is probably obvious, but I have no idea why. It seems as if I have declared the subroutine according to standard that I have read on the internet. The code is still a work in progress so I haven't written the OMP part yet. I'm getting the following errors from the ifort compiler:(adsbygoogle = window.adsbygoogle || []).push({});

summation.f90(18): error #6236: A specification statement cannot appear in the executable section.

subroutine compute(n)

----^

summation.f90(19): error #6236: A specification statement cannot appear in the executable section.

integer,parameter::dp2=selected_real_kind(15,300)

--------^

summation.f90(20): error #6236: A specification statement cannot appear in the executable section.

integer::i,count,t_stop,tick

--------^

summation.f90(21): error #6236: A specification statement cannot appear in the executable section.

real(kind=dp2),allocatable,dimension(:)::a,b

--------^

summation.f90(22): error #6236: A specification statement cannot appear in the executable section.

real(kind=dp2)::sum1

Here's my code:

Code (Text):program summation

implicit none

include 'omp_lib.h'

integer,parameter::dp1=selected_real_kind(15,300)

call compute(10.0d3)

call compute(2.0d0*(10.0d3))

call compute(5.0d0*(10.0d3))

call compute(10.0d4)

call compute(2.0d0*(10.0d4))

call compute(5.0d0*(10.0d4))

call compute(10.0d5)

call compute(2.0d0*(10.0d5))

call compute(5.0d0*(10.0d5))

call compute(10.0d6)

call compute(2.0d0*(10.0d6))

call compute(5.0d0*(10.0d6))

subroutine compute(n)

integer,parameter::dp2=selected_real_kind(15,300)

integer::i,count,t_stop,tick

real(kind=dp2),allocatable,dimension(:)::a,b

real(kind=dp2)::sum1

allocate(A(n))

allocate(B(n))

tick=1

count=0

t_stop=2*(10**20)

call system_clock(count,tick,t_stop)

sum1=0.0_dp2

do i=1,n

a(i)=i

b(i)=a(i)*a(i)

a(i)=a(i)+sqrt(abs(sin(b(i))))*2.34

sum1=sum1+a(i)

end do

write(*,*) n, sum1, count

deallocate(a)

deallocate(b)

end subroutine compute

end program summation

**Physics Forums - The Fusion of Science and Community**

Dismiss Notice

Join Physics Forums Today!

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

# A specification statement cannot appear in the executable section (fortran)

Loading...

Similar Threads - specification statement cannot | Date |
---|---|

Batch file that will open a media player at a specific time | Dec 29, 2017 |

C/++/# Question about a specific class method in C++ | Nov 7, 2017 |

Python Finding specific points in data array | Jul 20, 2016 |

Object detection for other specific objects, possible? | May 17, 2016 |

Fortran: specification statement cannot appear in the executable section | Sep 28, 2012 |

**Physics Forums - The Fusion of Science and Community**