× If you run into troubles, it is always a good habit to report the following information:
• the way build.mrcc was invoked
• the output of build.mrcc
• compiler version (for example: ifort -V, gfortran -v)
• blas/lapack versions
• as well as gcc and glibc versions

as well as the value of the relevant environmental variables, such OMP_NUM_THREADS, etc.

This information helps us a lot when figuring out what is going on with your compilation

GNU compilers cannot compile xmrcc.f and mrcc.f due to mismatched array sizes

8 months 2 weeks ago - 8 months 2 weeks ago #1043 by TiborGY
Dear developers,

I have found it impossible to compile MRCC using the GNU compilers (version 9.3.0), due to what seems to be a problem in the source code of xmrcc.f and mrcc.f, related to the size of the arrays being passed to the "rospc" and "wiadd" subroutines. My understanding of Fortran 77 is very limited but this is what I think the cause of the issue is:

For example:
1. In xmrcc.f, at line 3911, a 2 element array named iaddo is defined
2. The next time iaddo occurs (line 3954), it is used as the first argument for rospc
3. The first argument of rospc is defined (line 4069) as a 13 element array
4. I assume it is illegal in Fortran 77 to pass a 2 element array where the called subroutine requires a 13 element array, therefore the compilation is aborted.
I do not know what the code does or which array size would be correct, but hopefully someone who has worked on these files would know.
But at first glance, based on what rospc seems to be doing neither 2 or 13 is correct, since the do loop would access elements beyond index 12 if j ever becomes larger than 0. Alternatively, if j can never become larger than 0, then the entire do loop seems to be pointless.
I have managed to placate the compiler by increasing the size of a number of arrays in xmrcc and mrcc to 13 elements, but I have made these changes blindly and I do not know if they are problematic or not. I have attached the "fixed" source files to this post.

Please find the error messages from the compiler below:

xmrcc.f:
xmrcc.f:3954:23:

|                       1
Error: Actual argument contains too few elements for dummy argument ‘iadd’ (2/13) at (1)
xmrcc.f:3955:23:

3955 |             call rospc(wspc2,wspc3,nvirtoldact,noccoldact,wsmax)
|                       1
Error: Actual argument contains too few elements for dummy argument ‘iadd’ (2/13) at (1)
xmrcc.f:3285:25:

|                         1
Error: Actual argument contains too few elements for dummy argument ‘iadd’ (2/13) at (1)
xmrcc.f:3309:25:

|                         1
Error: Actual argument contains too few elements for dummy argument ‘iadd’ (2/13) at (1)

mrcc.f:
mrcc.f:7583:25:

|                         1
Error: Actual argument contains too few elements for dummy argument ‘iadd’ (2/13) at (1)
mrcc.f:7615:25:

|                         1
Error: Actual argument contains too few elements for dummy argument ‘iadd’ (2/13) at (1)
mrcc.f:9959:23:

|                       1
Error: Actual argument contains too few elements for dummy argument ‘iadd’ (2/13) at (1)
mrcc.f:9960:23:

9960 |             call rospc(wspc2,wspc3,nvirtoldact,noccoldact,wsmax)
|                       1
Error: Actual argument contains too few elements for dummy argument ‘iadd’ (2/13) at (1)
Attachments:
Last edit: 8 months 2 weeks ago by TiborGY.

1 month 2 weeks ago #1136 by hokru
GNU's gfortran become recently (I think v9 onwards) very strict in that regard.
It was common practice to mismatch the array sizes (not 100% sure what the official standards dictate).

Anyway, "-fallow-argument-mismatch" is the argument to add.
The following user(s) said Thank You: TiborGY