xraypy / feff85exafs

Feff8L: Open Source theoretical EXAFS fitting standards
Other
15 stars 7 forks source link

Compilation with -finit-local-zero fails #9

Open bruceravel opened 10 years ago

bruceravel commented 10 years ago

Using gfortran's -finit-local-zero flag seems like a good idea. Read about it here.

However, FMS/fmstot.f fails with this error:

gfortran -o FMS/fmstot.o -c -O3 -ffree-line-length-none -finit-local-zero FMS/fmstot.f FMS/fmstot.f:45.26:

 complex*16 dck, bmat                                              
                    1

Error: Automatic array 'bmat' at (1) cannot have an initializer FMS/fmstot.f:43.34:

 complex gtr(ipmin:ipmax,nex),gtrloc(ipmin:ipmax,nex) !KJ I added i
                             1

Error: Automatic array 'gtr' at (1) cannot have an initializer FMS/fmstot.f:43.58:

 complex gtr(ipmin:ipmax,nex),gtrloc(ipmin:ipmax,nex) !KJ I added i
                                                     1

Error: Automatic array 'gtrloc' at (1) cannot have an initializer scons: *\ [FMS/fmstot.o] Error 1

newville commented 10 years ago

Worse: when ffmod3() calls fmstot() it doesn't even pass in the last 4 arguments added by !KJ. So, I think this is in the cannot-ever-work category anyway.

So, I wonder if we really need the FMS code. It appears that ffmod3() will segfault.

Guessing: It looks like the compilation complaint must be due to passing in two array bounds ipmin:ipmax in the subroutine call. That seems a little weird, because it is definitely OK (and -finit-local-zero doesn't complain) when one array bound is given as an array dimension -- this happens all over the place. So, I don't know of a quick solution But that declaration of bmat: complex*16 bmat(-lx:lx,0:1,8, -lx:lx,0:1,8,ipmin:ipmax)

is pretty wild: 7 dimensions, most not starting at 1!