c program vect(input,output) integer loop, prtinc c real start, maxnum, minfrc c integer n01, n02, n03, n04, n05, n06, n07, n08, n09, n10, $ n11, n12, n13, n14, n15, n16, n17 c logical add, sub, mult, div c integer size01, size02, size03, size04, size05, $ size06, size07, size08, size09, size10, $ size11, size12, size13, size14, size15, $ size16, size17, size99 c integer sz16sq, sz17sq c c all parameter statements follow c c c c the following parameter, loop, controls the number of times c the major loop is executed. one execution of the major loop c causes all of the 17 minor loops to be executed once. c parameter ( loop = 10000) c c the following parameter, prtinc, controls the amount of output c parameter ( prtinc = 10 ) c parameter ( start = 1.01, maxnum = 1.e35, minfrc = 1./maxnum ) c parameter ( add = .true., sub = .false., $ mult = .true., div = .false. ) c c c the following size parameters may be freely changed by the user. c it may be desirable to have a mixture of large and small arrays. c c all matrices are square and the size parameter is the number of c rows (or columns) in the matrix, not the total number of elements. c the computation size*size to determine the number of elements. c matrices are used in loops 16 (size16) and 17 (size17). c parameter ( $ size01 = 100, size02 = 1000, $ size03 = 100, size04 = 6000, $ size05 = 1000, size06 = 1000, $ size07 = 1000, size08 = 1000, $ size09 = 1000, size10 = 1000, $ size11 = 1000, size12 = 4000, $ size13 = 1000, size14 = 1000, $ size15 = 1000, size16 = 100, $ size17 = 100 ) c parameter ( $ sz16sq = size16*size16, sz17sq = size17*size17 ) c c c the size of the '99' arrays is defined to be the largest size c of all the single dimension arrays. c parameter ( size99 = size04 ) c c the loop maximums are defined to be the size of the array c '$ c that are used in the loop. c parameter ( $ n01 = size01, n02 = size02, $ n03 = size03, n04 = size04, $ n05 = size05, n06 = size06, $ n07 = size07, n08 = size08, $ n09 = size09, n10 = size10, $ n11 = size11, n12 = size12, $ n13 = size13, n14 = size14, $ n15 = size15, n16 = size16, $ n17 = size17 ) c c the real array declaration statements follow c real v01a(size01), v01b(size01), v02a(size02), v02b(size02), $ v03a(size03), v04a(size04), v05a(size05), v06a(size06), $ v07a(size07), v08a(size08), v08b(size08), v09a(size09), $ v10a(size10), v11a(size11), v12a(size12), v12b(size12), $ v12c(size12), v13a(size13), v13b(size13), v14a(size14), $ v15a(size15) real v99a(size99), v99b(size99), v99c(size99) real m16a(size16,size16), m16b(size16,size16), $ m17a(size17,size17) c c each integer array is used as an index into a real array. c array i is used as an index into array v. c therefore, the size of array i is made the same c as array v. c c integer i15a(size15), i99a(size99), i99b(size99), i99c(size99) c c c all scalar variables are declared c real s, t, x integer i, j, k, m, index logical op01, op02, op03, op08, op12, op13, op16, op17 c------------------------------------------------------------ c initialize all variables c------------------------------------------------------------ data $ v01a /size01 * start/, v01b /size01 * start/, $ v02a /size02 * start/, v02b /size02 * start/, $ v03a /size03 * start/, v04a /size04 * start/, $ v05a /size05 * start/, v06a /size06 * start/, $ v07a /size07 * start/, v08a /size08 * start/, $ v08b /size08 * start/, v09a /size09 * start/, $ v10a /size10 * start/, v11a /size11 * start/, $ v12a /size12 * start/, v12b /size12 * start/, $ v12c /size12 * start/, v13a /size13 * start/, $ v13b /size13 * start/, v14a /size14 * start/, $ v15a /size15 * start/, $ v99a /size99 * start/, v99b /size99 * start/, $ v99c /size99 * start/, $ m16a /sz16sq * start/, m16b /sz16sq * start/, $ m17a /sz17sq * start/ c c initialize the starting mode of the operators for those loops c that alternate between add/subtract or multiply/divide c op01 = add op02 = add op03 = mult op08 = add op12 = add op13 = mult op16 = add op17 = mult c c initialize the integer arrays to 'random' values that are c within the proper range. c do 1 i=1,size15 i15a(i) = i 1 continue do 2 i=1,size99 i99a(i) = size99-i+1 2 continue do 3 i=1,size99 i99b(i) = i 3 continue do 4 i=1,size99 i99c(i) = max(i99a(i),i99b(i)) 4 continue c------------------------------------------------------------- c begin the execution of the loops c------------------------------------------------------------- do 1000 index=1,loop c c statements in wrong order c if (abs(v01a(2)).gt.maxnum) op01 = .not.op01 if (op01.eqv.add) then do 10, i=2,n01 v01b(i) = v01a(i-1) v01a(i) = v01a(i)+v99a(i) 10 continue else do 11, i=2,n01 v01b(i) = v01a(i-1) v01a(i) = v01a(i)-v99a(i) 11 continue endif c c dependency needing temporary c if (abs(v02b(2)).gt.maxnum) op02 = .not.op02 if (op02.eqv.add) then do 20, i=1,n02-1 v02a(i) = v99a(i) v02b(i) = v02b(i)+v02a(i+1) 20 continue else do 21, i=1,n02-1 v02a(i) = v99a(i) v02b(i) = v02b(i)-v02a(i+1) 21 continue endif c c loop with unnecessary scalar store c if (abs(v03a(2)).gt.maxnum .or. abs(v03a(2)).lt.minfrc) $ op03 = .not.op03 if (op03.eqv.mult) then do 30, i=1,n03 x = v99a(i) v03a(i) = v03a(i)*(x+v99b(i)) 30 continue else do 31, i=1,n03 x = v99a(i) v03a(i) = v03a(i)/(x+v99b(i)) 31 continue endif c c loop with ambiguous scalar temporary c t = 0. do 40, i=1,n04 s = v99a(i)*v99b(i) v04a(i) = s+t t = s 40 continue c c loop with subscript that may seem ambiguous c do 50, i=1,n05/2 v05a(i) = v05a(i+n05/2) 50 continue c c recursive loop that really isn't c do 60, i=1,n06-2,2 v06a(i+1) = v06a(i)*4. 60 continue c c loop with possible ambiguity because of scalar store c do 70, i=1,n07-1 j = i+1 v07a(i) = v07a(j) 70 continue c c loop that is partially recursive c if (abs(v08a(2)).gt.maxnum) op08 = .not.op08 if (op08.eqv.add) then do 80, i=2,n08 v08a(i) = v08a(i)+(v99a(i)*v99b(i)) v08b(i) = v08b(i-1)+v08a(i)+v99b(i) 80 continue else do 81, i=2,n08 v08a(i) = v08a(i)-(v99a(i)*v99b(i)) v08b(i) = v08b(i-1)+v08a(i)+v99b(i) 81 continue endif c c loop with unnecessary array stores c do 90, i=1,n09 v09a(i) = v99a(i)+v99b(i) v09a(i) = v99c(i)*v09a(i) 90 continue c c loop with independent conditional c t = 1. do 100, i=1,n10 if (v99c(i).ge.t) then x = v99a(i)*v99b(i)+3.1 y = v99a(i)+v99b(i)*2.9 v10a(i) = sqrt(x**2*y) endif 100 continue c c loop with noncontiguous addressing c do 110, i=1,n11,2 v11a(i) = v99b(i)+3.*v99c(i) 110 continue c c simple loop with dependent conditional c if (abs(v12a(2)).gt.maxnum) op12 = .not.op12 if (abs(v12b(2)).gt.maxnum) op12 = .not.op12 if (abs(v12c(2)).gt.maxnum) op12 = .not.op12 if (op12.eqv.add) then do 120, i=1,n12 v12a(i) = v12a(i)+v99b(i)+v99c(i) if (v12a(i).lt.0.) v12b(i) = v12b(i)+v99a(i)+v99b(i) v12c(i) = v12c(i)+v12a(i)+v99a(i) 120 continue else do 121, i=1,n12 v12a(i) = v12a(i)-v99b(i)-v99c(i) if (v12a(i).eq.0.) v12b(i) = v12b(i)-v99a(i)-v99b(i) v12c(i) = v12c(i)-v12a(i)-v99a(i) 121 continue endif c c complex loop with dependent conditional c if (abs(v13b(2)).gt.maxnum .or. abs(v13b(2)).lt.minfrc) $ op13 = .not.op13 if (op13.eqv.mult) then do 130, i=1,n13 v13a(i) = v99a(i)+v99c(i) if (v13a(i).eq.0.) then v13b(i) = v13a(i)*v13b(i) else v13a(i) = v99b(i)*v99c(i) v13b(i) = 1. endif 130 continue else do 131, i=1,n13 v13a(i) = v99a(i)-v99c(i) if (v13a(i).eq.0.) then v13b(i) = v13a(i)/v13b(i) else v13a(i) = v99b(i)/100. v13b(i) = 1. endif 131 continue endif c c loop with singularity handling c do 140, i=1,n14 if (v99b(i).gt.0.) v14a(i) = v99b(i)/v99c(i) 140 continue c c loop with simple gather/scatter subscripting c do 150, i=1,n15 v15a(i15a(i)) = $ sqrt(v99a(i99a(i))*v99b(i99b(i))+v99c(i99c(i))**2+.5) 150 continue c c loop with multiple dimension recursion c if (abs(m16a(2,2)).gt.maxnum) op16 = .not.op16 if (op16.eqv.add) then do 160, i=1,n16 do 160, j=2,n16 m16a(i,j) = m16a(i,j-1)+m16b(i,j) 160 continue else do 161, i=1,n16 do 161, j=2,n16 m16a(i,j) = m16a(i,j-1)-m16b(i,j) 161 continue endif c c loop with multiple dimension ambiguous subscripts c m = 1 j = m k = m+1 if (abs(m17a(2,2)).gt.maxnum .or. abs(m17a(2,2)).lt.minfrc) $ op17 = .not.op17 if (op17.eqv.mult) then do 170, i=2,n17 m17a(i,j) = m17a(i-1,k)*3.5 170 continue else do 171, i=2,n17 m17a(i,j) = m17a(i-1,k)/3.5 171 continue endif 1000 continue if (prtinc.ne.0) then write(*,10001) $ (v01a(i),i=1,size01,prtinc), (v01b(i),i=1,size01,prtinc), $ (v02a(i),i=1,size02,prtinc), (v02b(i),i=1,size02,prtinc), $ (v03a(i),i=1,size03,prtinc), $ (v05a(i),i=1,size05,prtinc), (v06a(i),i=1,size06,prtinc), $ (v07a(i),i=1,size07,prtinc), (v08a(i),i=1,size07,prtinc), $ (v08b(i),i=1,size07,prtinc), (v09a(i),i=1,size09,prtinc), $ (v10a(i),i=1,size10,prtinc), (v11a(i),i=1,size11,prtinc), $ (v12a(i),i=1,size12,prtinc), (v12b(i),i=1,size12,prtinc), $ (v12c(i),i=1,size12,prtinc), (v13a(i),i=1,size13,prtinc), $ (v13b(i),i=1,size13,prtinc), (v14a(i),i=1,size14,prtinc), $ (v15a(i),i=1,size15,prtinc) write(*,10002) $ ((m16a(i,j),i=1,size16,prtinc),j=1,size16,prtinc), $ ((m16b(i,j),i=1,size16,prtinc),j=1,size16,prtinc), $ ((m17a(i,j),i=1,size17,prtinc),j=1,size17,prtinc) endif c------------------------------------------------------------ c formats statements follow c------------------------------------------------------------ 10001 format('1values of single dimension arrays follow',/,(10e12.5)) 10002 format('1values of double dimension arrays follow',/,(10e12.5)) c stop end .