diff --git a/lib/spack/spack/compilers/xl.py b/lib/spack/spack/compilers/xl.py index 8fda5cb536..1e5ca52d33 100644 --- a/lib/spack/spack/compilers/xl.py +++ b/lib/spack/spack/compilers/xl.py @@ -112,6 +112,12 @@ def fc_version(cls, fc): older version of AIX and linux on power. """ fver = get_compiler_version(fc, '-qversion', r'([0-9]?[0-9]\.[0-9])') + if fver >= 16: + """Starting with version 16.1, the XL C and Fortran compilers + have the same version. So no need to downgrade the Fortran + compiler version to match that of the C compiler version. + """ + return str(fver) cver = float(fver) - 2 if cver < 10: cver = cver - 0.1 diff --git a/lib/spack/spack/compilers/xl_r.py b/lib/spack/spack/compilers/xl_r.py index 1afaa45e63..717d631873 100644 --- a/lib/spack/spack/compilers/xl_r.py +++ b/lib/spack/spack/compilers/xl_r.py @@ -113,6 +113,12 @@ def fc_version(cls, fc): older version of AIX and linux on power. """ fver = get_compiler_version(fc, '-qversion', r'([0-9]?[0-9]\.[0-9])') + if fver >= 16: + """Starting with version 16.1, the XL C and Fortran compilers + have the same version. So no need to downgrade the Fortran + compiler version to match that of the C compiler version. + """ + return str(fver) cver = float(fver) - 2 if cver < 10: cver = cver - 0.1