The following code uses the native %pl to plot a simple two cycle sine wave.
It includes the options(optimise) flag at the beginning to the file. (This is a cut down version of a 1000 line program which would benefit from optimisation).
When compiled with the 64 bit compiler everything is as expected. But when complied with 32 bit the program fails. “The function supplied as argument 7 is corrupt”.
This appears to be related to the %pl call back. If there is no %pl call back everything runs as expected.
In this program, the %pl call back does nothing apart from return the value 2. If the pl call back does something else e.g. there is a print statement added then the program runs as expected.
I stumbled on this one by accident, as the %pl was in the code as a placeholder and I was intending to come back to add to it later. So it’s not really a bug, but it is a bit unexpected. The reference to “argument 7” is a bit unhelpful as there are no functions with 7 arguments.
options(optimise)
module problem_mod
use clrwin
implicit none
integer, parameter :: dp = kind(1.d0)
integer, parameter :: n=360*2+1
real(kind=dp), parameter :: pi = 4.d0*atan(1.d0)
real(kind=dp), parameter :: deg2rad = pi/180.d0
real(kind=dp) x1(1:n), y1(1:n)
contains
integer function build_gui()
integer winio@, i
integer, save :: iw
x1 = (/(deg2rad*i,i=1,n,1)/) ; y1 = (/(sin(deg2rad*i),i=1,n,1)/)
iw = winio@('%mn[Exit]&','exit')
call winop@('%pl[native, independent, x_array, n_graphs=1,gridlines,framed,y_min=-1,y_max=1, dy=0.5]')
iw = winio@('%^pl&',600,400,n,x1,y1,pl_cb)
iw = winio@(' ')
build_gui =1
end function build_gui
integer function pl_cb()
pl_cb = 2
end function pl_cb
end module problem_mod
program main
use problem_mod
implicit none
integer i
i = build_gui()
end program main