From 762e294a3ff6003de1225f531c1d0ee55cd159d9 Mon Sep 17 00:00:00 2001
From: Philippe WAUTELET <philippe.wautelet@aero.obs-mip.fr>
Date: Fri, 10 Nov 2023 09:08:33 +0100
Subject: [PATCH] Philippe 10/11/2023: IO: bugfix for IO_Field_read_lfi_T0:
 copy of a class to a type => do a sourced allocation

(cherry picked from commit 0327b048cd8a6aaefee0021713101c929bf6ff08)
---
 src/LIB/SURCOUCHE/src/mode_io_read_lfi.f90 | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/LIB/SURCOUCHE/src/mode_io_read_lfi.f90 b/src/LIB/SURCOUCHE/src/mode_io_read_lfi.f90
index 7d943fbea..0fc83da28 100644
--- a/src/LIB/SURCOUCHE/src/mode_io_read_lfi.f90
+++ b/src/LIB/SURCOUCHE/src/mode_io_read_lfi.f90
@@ -1,4 +1,4 @@
-!MNH_LIC Copyright 1994-2021 CNRS, Meteo-France and Universite Paul Sabatier
+!MNH_LIC Copyright 1994-2023 CNRS, Meteo-France and Universite Paul Sabatier
 !MNH_LIC This is part of the Meso-NH software governed by the CeCILL-C licence
 !MNH_LIC version 1. See LICENSE, CeCILL-C_V1-en.txt and CeCILL-C_V1-fr.txt
 !MNH_LIC for details. version 1.
@@ -592,13 +592,13 @@ INTEGER(KIND=LFIINT)                            :: IRESP, ITOTAL
 INTEGER                                         :: ILENG
 INTEGER(KIND=MNHINT64),DIMENSION(:),ALLOCATABLE :: IWORK
 LOGICAL                                         :: GGOOD
-TYPE(tfieldmetadata_base)                       :: TZFIELD
+CLASS(tfieldmetadata_base), ALLOCATABLE         :: TZFIELD
 INTEGER, DIMENSION(3)                           :: ITDATE    ! date array
 REAL,DIMENSION(1)                               :: ZTIME
 !
 CALL PRINT_MSG(NVERB_DEBUG,'IO','IO_Field_read_lfi_T0',TRIM(TPFILE%CNAME)//': reading '//TRIM(TPFIELD%CMNHNAME))
 !
-TZFIELD = TPFIELD
+ALLOCATE( TZFIELD, SOURCE = TPFIELD ) ! TZFIELD = TPFIELD (sourced allocation, TZFIELD is allocated to a clone of TPFIELD)
 !
 ! Read date
 !
-- 
GitLab