Repository: spack/spack

Issue:
Installation issue: mumps
I am having trouble building MUMPS 5.3.3 with GCC 10.2.1 in the context of a build of LiDO (an optimization package that uses MFEM) on Fedora 33 Linux.

### Steps to reproduce the issue

```console
$ spack install  mumps@5.3.3%gcc@10.2.1+complex+double+float~int64~metis~mpi~parmetis~ptscotch~scotch+shared patches=1946864d2106f7414aaa4dbd4dbc068b7804af7c1588381e814b268a56140a52 arch=linux-fedora33-haswell
[+] /usr (external netlib-lapack-3.6.1-izhvqqtmlsd736cj6tcgrahet6i763hs)
==> Installing mumps-5.3.3-jevldzltrerika5vfhcvgd4f2knn7z3g
==> No binary for mumps-5.3.3-jevldzltrerika5vfhcvgd4f2knn7z3g found: installing from source
==> Using cached archive: /home/user/current/lido/lido-2.0/uberenv_libs/spack/var/spack/cache/_source-cache/archive/27/27e7749ac05006bf8e81a457c865402bb72a42bf3bc673da49de1020f0f32011.tar.gz
==> mumps: Executing phase: 'install'
==> Error: ProcessError: Command exited with status 2:
    'make' '-j8' 'sexamples'

7 errors found in build log:
     23    /home/user/current/lido/lido-2.0/uberenv_libs/spack/lib/spack/en
           v/gcc/gcc -I../include -fPIC -O  -c multisector.c -omultisector.o
     24    /home/user/current/lido/lido-2.0/uberenv_libs/spack/lib/spack/en
           v/gcc/gcc -I../include -fPIC -O  -c gelim.c -ogelim.o
     25    mpi.f:575:72:
     26    
     27      575 |          CALL MUMPS_COPY_LOGICAL( SENDBUF, RECVBUF, CNT )
     28          |                                                             
                      1
  >> 29    Error: Type mismatch in argument 's' at (1); passed INTEGER(4) to LO
           GICAL(4)
     30    mpi.f:577:72:
     31    
     32      577 |          CALL MUMPS_COPY_REAL( SENDBUF, RECVBUF, CNT )
     33          |                                                             
                      1
  >> 34    Error: Type mismatch in argument 's' at (1); passed INTEGER(4) to RE
           AL(4)
     35    mpi.f:580:72:
     36    
     37      580 |          CALL MUMPS_COPY_DOUBLE_PRECISION( SENDBUF, RECVBUF,
            CNT )
     38          |                                                             
                      1
  >> 39    Error: Type mismatch in argument 's' at (1); passed INTEGER(4) to RE
           AL(8)
     40    mpi.f:582:72:
     41    
     42      582 |          CALL MUMPS_COPY_COMPLEX( SENDBUF, RECVBUF, CNT )
     43          |                                                             
                      1
  >> 44    Error: Type mismatch in argument 's' at (1); passed INTEGER(4) to CO
           MPLEX(4)
     45    mpi.f:584:72:
     46    
     47      584 |          CALL MUMPS_COPY_DOUBLE_COMPLEX( SENDBUF, RECVBUF, C
           NT )
     48          |                                                             
                      1
  >> 49    Error: Type mismatch in argument 's' at (1); passed INTEGER(4) to CO
           MPLEX(8)
     50    mpi.f:586:72:
     51    
     52      586 |          CALL MUMPS_COPY_2DOUBLE_PRECISION( SENDBUF, RECVBUF
           , CNT )
     53          |                                                             
                      1
  >> 54    Error: Type mismatch in argument 's' at (1); passed INTEGER(4) to RE
           AL(8)
     55    mpi.f:590:72:
     56    
     57      590 |         CALL MUMPS_COPY_INTEGER8( SENDBUF, RECVBUF, CNT )
     58          |                                                             
                      1
  >> 59    Error: Type mismatch in argument 's' at (1); passed INTEGER(4) to IN
           TEGER(8)
     60    make[2]: *** [Makefile:17: mpi.o] Error 1
     61    make[2]: Leaving directory '/home/user/current/lido/lido-2.0/ube
           renv_libs/spack/var/spack/stage/spack-stage-mumps-5.3.3-jevldzltreri
           ka5vfhcvgd4f2knn7z3g/spack-src/libseq'
     62    /home/user/current/lido/lido-2.0/uberenv_libs/spack/lib/spack/en
           v/gcc/gcc -I../include -fPIC -O  -c bucket.c -obucket.o
     63    make[1]: *** [Makefile:62: libseqneeded] Error 2
     64    make[1]: *** Waiting for unfinished jobs....
     65    /home/user/current/lido/lido-2.0/uberenv_libs/spack/lib/spack/en
           v/gcc/gcc -I../include -fPIC -O  -c tree.c -otree.o

See build log for details:
  /home/user/current/lido/lido-2.0/uberenv_libs/spack/var/spack/stage/spack-stage-mumps-5.3.3-jevldzltrerika5vfhcvgd4f2knn7z3g/spack-build-out.txt

```
### Information on your system

* **Spack:** 0.16.0
* **Python:** 3.9.1
* **Platform:** linux-fedora33-haswell
* **Concretizer:** original

### Additional information

* [spack-build-out.txt](https://github.com/spack/spack/files/5876329/spack-build-out.txt)

### General information

- [x] I have run `spack debug report` and reported the version of Spack/Python/Platform
- [x] I have run `spack maintainers <name-of-the-package>` and @mentioned any maintainers
- [x] I have uploaded the build log and environment files
- [x] I have searched the issues of this repo and believe this is not a duplicate



Discussion:
This issue, https://github.com/spack/spack/issues/19687, is similar, but the errors seem to be different.

Adding `-fallow-argument-mismatch` to the gfortran compiler flags would probably resolve this issue.

Resolving patch:
diff --git a/var/spack/repos/builtin/packages/mumps/package.py b/var/spack/repos/builtin/packages/mumps/package.py
--- a/var/spack/repos/builtin/packages/mumps/package.py
+++ b/var/spack/repos/builtin/packages/mumps/package.py
@@ -155,8 +155,7 @@ def write_makefile_inc(self):
                 makefile_conf.extend([
                     'OPTF = %s -O  -DALLOW_NON_INIT %s' % (
                         fpic,
-                        '-fdefault-integer-8' if using_gcc
-                                              else '-i8'),  # noqa
+                        '-fdefault-integer-8' if using_gcc else '-i8'),  # noqa
                 ])
 
             makefile_conf.extend([
@@ -275,6 +274,15 @@ def write_makefile_inc(self):
                 makefile_inc = '\n'.join(makefile_conf)
                 fh.write(makefile_inc)
 
+    def flag_handler(self, name, flags):
+        if name == 'fflags':
+            if self.spec.satisfies('%gcc@10:'):
+                if flags is None:
+                    flags = []
+                flags.append('-fallow-argument-mismatch')
+
+        return (flags, None, None)
+
     def install(self, spec, prefix):
         self.write_makefile_inc()
 


Test patch: