# AGRIF doesn't compile with gcc15 due to conflicting types

**URL:** <https://nemo-ocean.discourse.group/t/agrif-doesnt-compile-with-gcc15-due-to-conflicting-types/1022>\
**Category:** Versions\
**Tags:** AGRIF\
**Created:** [12 May 2026 06:26 UTC](https://nemo-ocean.discourse.group/t/agrif-doesnt-compile-with-gcc15-due-to-conflicting-types/1022 "2026-05-12T06:26:34Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Franziska](https://avatars.discourse-cdn.com/v4/letter/f/8797f3/32.png) [@Franziska](https://nemo-ocean.discourse.group/u/Franziska)\
**Post date:** [12 May 2026 06:26 UTC](https://nemo-ocean.discourse.group/t/agrif-doesnt-compile-with-gcc15-due-to-conflicting-types/1022/1 "2026-05-12T06:26:35Z")

</div>

Hi,

when compiling an AGRIF configuration (e.g. AGRIF\_DEMO) using GCC 15 (which appears to be more restrict than previous versions) it fails with the following error message:

```auto
.../nemo/ext/AGRIF/LIB/UtilFortran.c:266:6: error: conflicting types for 'Write_Closing_Module'; have 'void(int)'
  266 | void Write_Closing_Module(int forend)
      | ^ ~~~~~~~~~~~~~~~~~~~
In file included from .../nemo/ext/AGRIF/LIB/UtilFortran.c:38:
.../nemo/ext/AGRIF/LIB/decl.h:535:13: note: previous declaration of 'Write_Closing_Module' with type 'void(void)'
  535 | extern void Write_Closing_Module();
      | ^ ~~~~~~~~~~~~~~~~~~~

```

This is in NEMO5; tested different branches including main.

A fix or guidance on how to fix this is appreciated.

Best regards  
Franziska

---

<div class="post-metadata">

**Author:** ![smasson](https://avatars.discourse-cdn.com/v4/letter/s/eb9ed0/32.png) [@smasson](https://nemo-ocean.discourse.group/u/smasson)\
**Post date:** [12 May 2026 07:50 UTC](https://nemo-ocean.discourse.group/t/agrif-doesnt-compile-with-gcc15-due-to-conflicting-types/1022/2 "2026-05-12T07:50:51Z")

</div>

Can you try this modification in `ext/AGRIF/LIB/decl.h`

```diff
-extern void Write_Closing_Module();
+extern void Write_Closing_Module(int forend);

```

---

<div class="post-metadata">

**Author:** ![Franziska](https://avatars.discourse-cdn.com/v4/letter/f/8797f3/32.png) [@Franziska](https://nemo-ocean.discourse.group/u/Franziska)\
**Post date:** [12 May 2026 08:43 UTC](https://nemo-ocean.discourse.group/t/agrif-doesnt-compile-with-gcc15-due-to-conflicting-types/1022/3 "2026-05-12T08:43:48Z")

</div>

Thanks a lot @smasson!  
That was quick and it works!

I expected more conflicts of that kind to appear with all the similar definitions in decl.h but apparently this was the only one really running into a conflict.

Side note: some „type mismatches" occur down the road, which I turned from errors into warnings through compiler flags, so this seems to be OK, at least for compilation but should probably be fixed at some point.

---

<div class="post-metadata">

**Author:** ![smasson](https://avatars.discourse-cdn.com/v4/letter/s/eb9ed0/32.png) [@smasson](https://nemo-ocean.discourse.group/u/smasson)\
**Post date:** [12 May 2026 09:04 UTC](https://nemo-ocean.discourse.group/t/agrif-doesnt-compile-with-gcc15-due-to-conflicting-types/1022/4 "2026-05-12T09:04:38Z")

</div>

I am happy to see that it works!  
I personally still encounter compilation errors that appear to be macOS-specific 😩

```shell
/Users/smasson/codes/nemo_main/mk/agrifpp.sh: line 73: 86018 Trace/BPT trap: 5 ${MYDIR}/conv ${MYDIR}/agrif_oce.in -rm -incdir ${MYDIR}/inc -comdirout ${MYDIR}/obj -convfile ${MYFILE}
fcm_internal compile failed (34048)
make: *** [/Users/smasson/codes/nemo_main/cfgs/AGRIF_DEMO/BLD_SCT_AGRIF/Makefile:608: dom_oce.f90] Error 1
make -s -f /Users/smasson/codes/nemo_main/cfgs/AGRIF_DEMO/BLD_SCT_AGRIF/Makefile -j 1 all failed (2) at /Users/smasson/codes/nemo_main/ext/FCM/bin/../lib/Fcm/Build.pm line 597.

```

Could you give us more details about the “type mismatches” you had?   
Which versions compiler flags did you use?

---

<div class="post-metadata">

**Author:** ![Franziska](https://avatars.discourse-cdn.com/v4/letter/f/8797f3/32.png) [@Franziska](https://nemo-ocean.discourse.group/u/Franziska)\
**Post date:** [12 May 2026 09:21 UTC](https://nemo-ocean.discourse.group/t/agrif-doesnt-compile-with-gcc15-due-to-conflicting-types/1022/5 "2026-05-12T09:21:27Z")

</div>

To turn type mismatches into warnings, I use `-fallow-argument-mismatch`  
Below I share my full list of compiler options, which I’ve been already using with gcc14 and older versions (that did not yet complain about the conflicting types).  
Particularly zero-initialization and fcommon were mandatory (see my [earlier ticket](https://nemo-ocean.discourse.group/t/agrif-memory-allocation-errors-when-compiled-with-gnu-nemo-5/984/4)).

The type mismatches occur in ext/AGRIF/AGRIF\_FILES/ `modmpp.F90`, `modinterp.F90` and `modupdate.F90` with

```auto
.../nemo/cfgs/AGRIF_DEMO/BLD/ppsrc/agrif/modmpp.f90:348:22:

  348 | call MPI_SEND(sendtoproc(k),1,MPI_LOGICAL,k,etiquette,Agrif_mpi_comm,code)
      | 1
......
  683 | call MPI_SEND( tab3D( imin(1):imax(1), &
      | 2   
Warning: Type mismatch between actual argument at (1) and actual argument at (2) (LOGICAL(4)/REAL(8)).
...nemo/cfgs/AGRIF_DEMO/BLD/ppsrc/agrif/modmpp.f90:361:22:

  361 | call MPI_RECV(res,1,MPI_LOGICAL,k,etiquette,Agrif_mpi_comm,statut,code)
      | 1
......
  523 | call MPI_RECV(temprecv%array1,datasize,Agrif_MPI_prec,k,etiquette, &
      | 2
Warning: Type mismatch between actual argument at (1) and actual argument at (2) (LOGICAL(4)/REAL(8)).

```

```auto
.../nemo/cfgs/AGRIF_DEMO/BLD/ppsrc/agrif/modinterp.f90:732:27:

  711 | call MPI_ALLGATHER(tab3,4*nbdim,MPI_INTEGER,tab4,4*nbdim,MPI_INTEGER,Agrif_mpi_comm,code)
      | 2
......
  732 | call MPI_ALLGATHER(memberin1,1,MPI_LOGICAL,memberinall,1,MPI_LOGICAL,Agrif_mpi_comm,code)
      | 1
Warning: Type mismatch between actual argument at (1) and actual argument at (2) (LOGICAL(4)/INTEGER(4)).
.../nemo/cfgs/AGRIF_DEMO/BLD/ppsrc/agrif/modinterp.f90:732:51:

  711 | call MPI_ALLGATHER(tab3,4*nbdim,MPI_INTEGER,tab4,4*nbdim,MPI_INTEGER,Agrif_mpi_comm,code)
      | 2
......
  732 | call MPI_ALLGATHER(memberin1,1,MPI_LOGICAL,memberinall,1,MPI_LOGICAL,Agrif_mpi_comm,code)
      | 1
Warning: Type mismatch between actual argument at (1) and actual argument at (2) (LOGICAL(4)/INTEGER(4)).

```

```auto
.../nemo/cfgs/AGRIF_DEMO/BLD/ppsrc/agrif/modupdate.f90:677:27:

  665 | call MPI_ALLGATHER(tab3,4*nbdim,MPI_INTEGER,tab4,4*nbdim,MPI_INTEGER,Agrif_mpi_comm,code)
      | 2
......
  677 | call MPI_ALLGATHER(memberin1,1,MPI_LOGICAL,memberinall,1,MPI_LOGICAL,Agrif_mpi_comm,code)
      | 1
Warning: Type mismatch between actual argument at (1) and actual argument at (2) (LOGICAL(4)/INTEGER(4)).
.../nemo/cfgs/AGRIF_DEMO/BLD/ppsrc/agrif/modupdate.f90:677:51:

  665 | call MPI_ALLGATHER(tab3,4*nbdim,MPI_INTEGER,tab4,4*nbdim,MPI_INTEGER,Agrif_mpi_comm,code)
      | 2
......
  677 | call MPI_ALLGATHER(memberin1,1,MPI_LOGICAL,memberinall,1,MPI_LOGICAL,Agrif_mpi_comm,code)
      | 1
Warning: Type mismatch between actual argument at (1) and actual argument at (2) (LOGICAL(4)/INTEGER(4)).

```

arch.fcm

```auto
%NCDF_INC -I%NCDF_HOME/include -I%HDF5_HOME/include
%NCDF_LIB -L%HDF5_HOME/lib -L%NCDF_HOME/lib -L%NCDF_C_HOME/lib -lnetcdf -lnetcdff -lhdf5 -lz
%XIOS_INC -I%XIOS_HOME/inc
%XIOS_LIB -L%XIOS_HOME/lib -lxios -lstdc++

# key_nosignedzero required by NEMO5
%CPP cpp -P -Dkey_nosignedzero
%FC mpif90
%FCFLAGS -O1 -fdefault-real-8 -ffree-line-length-none -fallow-argument-mismatch -finit-local-zero -finit-integer=0 -finit-real=zero -g -fbacktrace

%FFLAGS %FCFLAGS
%LD mpif90
%FPPFLAGS -P -traditional
%LDFLAGS -Wl,--allow-multiple-definition 
%AR ar
%ARFLAGS -r
%MK gmake
%USER_INC %XIOS_INC %NCDF_INC
%USER_LIB %XIOS_LIB %NCDF_LIB

%CC mpicc
%CFLAGS -O0 -fcommon 

```

I’m using gcc 15.2.0, openmpi 5.0.10, netcdf-fortran 4.6.2
