Compilation error with gfortran10


Just a quick note to say that I found compilation errors while compiling with gfortran10 (which is probably standard on newer linux distributions as in debian11).

To solve these errors the “-fallow-argument-mismatch” flag needs to be included.

I share my makefile which links ccx_v2.19 with system libraries. So on debian based distributions (ubuntu,etc), these libraries are installed by:

$ sudo apt install libspooles-dev libarpack2-dev liblapack-dev libblas-dev

##### MAKEFILE_MT #####
INCLUDES = -I /usr/include/spooles/

FFLAGS = -Wall -O2 -fopenmp -fallow-argument-mismatch


.c.o :
	$(CC) $(CFLAGS) $(INCLUDES) -c $<
.f.o :
	$(FC) $(FFLAGS) -c $<


SCCXMAIN = ccx_2.19.c

OCCXF = $(SCCXF:.f=.o)
OCCXC = $(SCCXC:.c=.o)

LIBS = -lspooles -larpack -llapack -lblas -lpthread -lm -lc

ccx_2.19_MT: $(OCCXMAIN) ccx_2.19_MT.a  $(LIBS)
	./; $(CC) $(CFLAGS) -c ccx_2.19.c; $(FC) -fopenmp -Wall -O2 -o $@ $(OCCXMAIN) ccx_2.19_MT.a $(LIBS)

ccx_2.19_MT.a: $(OCCXF) $(OCCXC)
	ar vr $@ $?

Thank you for this workaround. The solution would be to fix the compiler errors, though, as these mismatches might actually be bugs. I tried digging through the code, but my fortran day are now long past (10+ years), so I do not know if I fixed the issues or broke the code.

gfortran -Wall -O2 -c crackpropagations.f

  123 |      &       "*CRACK PROPAGATION%")
      |                                                                        1
Error: Missing actual argument for argument ‘_formal_4’ at (1)

This seems to be missing an argument, I do not know if I choose the right one, though:

<      &       "*CRACK PROPAGATION%")
>      &       "*CRACK PROPAGATION%", ier)

The next item is this:

gfortran -Wall -O2 -c cubtri.f

  131 |       CALL CUBRUL(F, VEC, W(1,1), IDATA, RDATA)
      |                  1
Error: Interface mismatch in dummy procedure ‘f’ at (1): 'f' is not a function

  170 |         CALL CUBRUL(F, VEC, W(1,J), IDATA, RDATA)
      |                    1
Error: Interface mismatch in dummy procedure ‘f’ at (1): 'f' is not a function

This now wants an interface:

<       EXTERNAL F,rnderr
>       interface
>          real*8 function F(x, y, idata, rdata)
>          real*8 x, y
>          integer, dimension(:) :: idata
>          real*8, dimension(:) :: rdata
>          end function f
>       end interface
>       EXTERNAL rnderr

I have no idea how to do this F77 conforming, though.

The next item is this:

gfortran -Wall -O2 -c resultsmech_us3.f
f951: Warning: Nonconforming tab character in column 1 of line 304 [-Wtabs]

  353 |      &           xstiff,ncmat_)
      |                        2
  465 |      &     xstiff,alcon)
      |                  1
Error: Type mismatch between actual argument at (1) and actual argument at (2) (REAL(8)/INTEGER(4)).

The call is to us3_materialdata_me(), which expects an integer as its last argument, but gets passed real*8 alcon(0:6,ntmat_,*). Looking at the code in us3_sub.f, this should be ‘ncmat_’ lika above, as it agrees with the dimension of the first argument etc.:

< 	      vl(j,k)   = v(j,konl(k))   ! uvw
>           vl(j,k)   = v(j,konl(k))   ! uvw
<      &           xstiff,ncmat_)     
>      &           xstiff,ncmat_)
<      &     xstiff,alcon)
>      &     xstiff,ncmat_)

The diff also takes care of the tab character and a bogus indentation.

I haven’t looked into this yet:

gfortran -Wall -O2 -c us4_sub.f

  494 |        call us4_Ni(ri,si,X,Nrs,dNr,dNs,Jm,invJm,detJm,detinvJm,dNx,dNy) ! s4 interpolation
      |                                          1
Error: Rank mismatch in argument ‘invjm’ at (1) (rank-2 and scalar)

Edit: Never mind. invJm is the inverse of the Jacobian and should be REAL*8 :: invJm(2,2)

The next item is this:
gfortran -Wall -O2 -c cubtri.f

I modified the file (see attachment). I have checked it with my usual check files and goes well. Further checking would require running all test files and compare with the ones provided by developers.

Thanks for the solution of cubtri.f