Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!csd4.csd.uwm.edu!uxc.cso.uiuc.edu!uxc.cso.uiuc.edu!ux1.cso.uiuc.edu!uxa.cso.uiuc.edu!gsg0384 From: gsg0384@uxa.cso.uiuc.edu Newsgroups: comp.lang.fortran Subject: Re: How much illegal are these? Message-ID: <116400002@uxa.cso.uiuc.edu> Date: 22 Aug 89 02:31:00 GMT Lines: 71 Nf-ID: #N:uxa.cso.uiuc.edu:116400002:000:1640 Nf-From: uxa.cso.uiuc.edu!gsg0384 Aug 21 21:31:00 1989 Ok, Ok. The more detailed one that I wanted to ask is as follows: program main real a(200), b(10, 20), c(200) data b/200*1./, a/200*1./ do 10 i = 1, 10 b(i,1) = 0. 10 continue do 20 j = 1, 10 b(1,j) = 0. 20 continue call sub(10, 10, a, b, c) print*, c stop end c--------------- subroutine sub(m, n, a, b, c) real a(m,n), b(m,n), c(m,n) do 20 i = 1, m do 10 j = 1, n c(i,j) = b(i,j)*a(i-1,j-1) 10 continue 20 continue return end On Ardent1, there is a compiler switch -subcheck which gives warning at run time. But the result is what I intended, the c(.,.) = zero's for the out-of-bounds. Without the switch, the result is again what I intended. On Apollos (SR10.1), with the BSD f77 switch -C, the program terminates with a message. 'Arithmetic exception: Subscript range'. However, without -C, the result was again what I inteded. OK. SO they are illegal. Then how about this modified sub? c-------------- subroutine sub(m, n, a, b, c) real a(m,n), b(m,n), c(m,n) do 20 i = 1, m do 10 j = 3, n c ^ Notice! c(i,j) = b(i,j)*a(i-1,j-1) 10 continue 20 continue return end The behavior on Apollo is the same. But on Ardent, the compiler does not catch anything wrong, even at the run time with -subcheck switch. Ok, OK, They are still illegal. Then how can I vectorize this without if's and without introducing more do loops? Thank you for kind replies in the past and for the new replies I get. Hugh SONG