After more testing I found that code position was the key so figured maybe something to do with the stack inside the routine since I am using dynamic arrays. I found that by reducing the size of my four fixed arrays to this it worked.
opp[0..9999] of real;
hip: array[0..9999] of real;
lop: array[0..9999] of real;
clp: array[0..9999] of real;
Then I tried to see what size of array it would let me pass to my function. These values worked but 12210 on the two arrays didn't.
opp[0..9999] of real;
hip: array[0..12209] of real;
lop: array[0..12209] of real;
clp: array[0..9999] of real;
The problem was still not straight forward because I changed the declaration to this and it didn't work anymore.
opp,hip,lop,clp: array[0..9999] of real;
At no time is a compile error given saying I can't have large arrays.