# HDF-4.2.14 compilation error with GCC-10

**URL:** <https://forum.hdfgroup.org/t/hdf-4-2-14-compilation-error-with-gcc-10/6625>\
**Category:** HDF4\
**Created:** [February 3, 2020, 3:36pm UTC](https://forum.hdfgroup.org/t/hdf-4-2-14-compilation-error-with-gcc-10/6625 "2020-02-03T15:36:20Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![sagitter1](https://forum.hdfgroup.org/letter_avatar_proxy/v4/letter/s/f475e1/32.png) [@sagitter1](https://forum.hdfgroup.org/u/sagitter1)\
**Post date:** [February 3, 2020, 3:36pm UTC](https://forum.hdfgroup.org/t/hdf-4-2-14-compilation-error-with-gcc-10/6625/1 "2020-02-03T15:36:20Z")

</div>

Hi all.

HDF(4)-4.2.14 [is not compiling](https://kojipkgs.fedoraproject.org//work/tasks/9298/41319298/build.log) with latest GNU compiler release 10.0.1 on Fedora Linux (devel branch):

```
/bin/sh ../../libtool --tag=F77 --mode=compile gfortran -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -I/usr/lib64/gfortran/modules -c -o mfgrff.lo ../../../hdf/src/mfgrff.f
libtool: compile: gfortran -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -I/usr/lib64/gfortran/modules -c ../../../hdf/src/mfgrff.f -o mfgrff.o
f951: Warning: '-Werror=' argument '-Werror=format-security' is not valid for Fortran
../../../hdf/src/mfgrff.f:155:48:
  132 | mgsnatt = mgisattr(riid, name, nt, count, data, len(name))
      | 2
......
  155 | mgsattr = mgisattr(riid, name, nt, count, data, len(name))
      | 1
Error: Type mismatch between actual argument at (1) and actual argument at (2) (CHARACTER(0)/INTEGER(4)).
make[3]: *** [Makefile:732: mfgrff.lo] Error 1

```

According to the [GCC-10 release note](https://gcc.gnu.org/gcc-10/changes.html), this type of error can be temporarily corrected by the flag `-fallow-argument-mismatch` as workaround.

Please, take a look before next HDF4 release.

Thanks.

---

<div class="post-metadata">

**Author:** ![matthew.thompson](https://forum.hdfgroup.org/user_avatar/forum.hdfgroup.org/matthew.thompson/32/1745_2.png) [@matthew.thompson](https://forum.hdfgroup.org/u/matthew.thompson)\
**Post date:** [May 11, 2020, 4:19pm UTC](https://forum.hdfgroup.org/t/hdf-4-2-14-compilation-error-with-gcc-10/6625/2 "2020-05-11T16:19:26Z")

</div>

Just hit this myself in trying out the newly stable and released GCC 10.1. If I pass in `-fallow-argument-mismatch` I do get a good compile.

Thanks @sagitter1 for posting this!

---

<div class="post-metadata">

**Author:** ![jeremy.solbrig](https://forum.hdfgroup.org/letter_avatar_proxy/v4/letter/j/3bc359/32.png) [@jeremy.solbrig](https://forum.hdfgroup.org/u/jeremy.solbrig)\
**Post date:** [December 9, 2022, 11:05pm UTC](https://forum.hdfgroup.org/t/hdf-4-2-14-compilation-error-with-gcc-10/6625/3 "2022-12-09T23:05:11Z")

</div>

For anyone who gets here, this is still an issue in HDF4 4.2.15.

---

<div class="post-metadata">

**Author:** ![bmribler](https://forum.hdfgroup.org/letter_avatar_proxy/v4/letter/b/a6a055/32.png) [@bmribler](https://forum.hdfgroup.org/u/bmribler)\
**Post date:** [December 10, 2022, 4:03am UTC](https://forum.hdfgroup.org/t/hdf-4-2-14-compilation-error-with-gcc-10/6625/4 "2022-12-10T04:03:37Z")

</div>

Thank you for reporting this. I added the issue, [https://jira.hdfgroup.org/browse/HDFFR-1605](https://jira.hdfgroup.org/browse/HDFFR-1605), for the coming release of HDF4.

---

<div class="post-metadata">

**Author:** ![dave.allured](https://forum.hdfgroup.org/letter_avatar_proxy/v4/letter/d/8e8cbc/32.png) [@dave.allured](https://forum.hdfgroup.org/u/dave.allured)\
**Post date:** [December 10, 2022, 3:18pm UTC](https://forum.hdfgroup.org/t/hdf-4-2-14-compilation-error-with-gcc-10/6625/5 "2022-12-10T15:18:49Z")

</div>

A clean fix is to change the called function on line 155 from **mgisattr** to **mgiscatt**. It is lucky that the correctly typed function had already been added.

However, **make -k** exposes 165 other argument mismatch errors with gfortran 12. This reflects an old fortran coding style for generic argument passing, where we used to care only about passing the start address of data objects of arbitrary type or shape.

For many of these cases, I think there would be a fair amount of work to split old-style generic procedures into type- and rank-specific ones. Is it worth the effort for this older HDF4 package, or is **-fallow-argument-mismatch** good enough for the future?

---

<div class="post-metadata">

**Author:** ![bmribler](https://forum.hdfgroup.org/letter_avatar_proxy/v4/letter/b/a6a055/32.png) [@bmribler](https://forum.hdfgroup.org/u/bmribler)\
**Post date:** [December 14, 2022, 6:37pm UTC](https://forum.hdfgroup.org/t/hdf-4-2-14-compilation-error-with-gcc-10/6625/6 "2022-12-14T18:37:15Z")

</div>

I see your point. I’ll bring it up to my group.  
The answer is it’s not worth the effort and we’ll go with the flag: [https://github.com/HDFGroup/hdf4/pull/10](https://github.com/HDFGroup/hdf4/pull/10).
