Index: codes/icosagcm/devel/XCodeML/external_src/iso_c_binding.f90
===================================================================
--- codes/icosagcm/devel/XCodeML/external_src/iso_c_binding.f90	(revision 823)
+++ codes/icosagcm/devel/XCodeML/external_src/iso_c_binding.f90	(revision 823)
@@ -0,0 +1,198 @@
+module iso_c_binding
+    implicit none
+
+    integer, parameter :: POINTER_LEN = 8
+
+    integer (KIND=4), parameter :: C_INT = 4
+    integer (KIND=4), parameter :: C_SHORT = 2
+    integer (KIND=4), parameter :: C_LONG = POINTER_LEN
+    integer (KIND=4), parameter :: C_LONG_LONG = 8
+    integer (KIND=4), parameter :: C_SIGNED_CHAR = 1
+    integer (KIND=4), parameter :: C_SIZE_T = POINTER_LEN
+
+    integer (KIND=4), parameter :: C_INT8_T = 1
+    integer (KIND=4), parameter :: C_INT16_T = 2
+    integer (KIND=4), parameter :: C_INT32_T = 4
+    integer (KIND=4), parameter :: C_INT64_T = 8
+    integer (KIND=4), parameter :: C_INT_LEAST8_T = 1
+    integer (KIND=4), parameter :: C_INT_LEAST16_T = 2
+    integer (KIND=4), parameter :: C_INT_LEAST32_T = 4
+    integer (KIND=4), parameter :: C_INT_LEAST64_T = 8
+    integer (KIND=4), parameter :: C_INT_FAST8_T = 1
+    integer (KIND=4), parameter :: C_INT_FAST16_T = POINTER_LEN
+    integer (KIND=4), parameter :: C_INT_FAST32_T = POINTER_LEN
+    integer (KIND=4), parameter :: C_INT_FAST64_T = 8
+    integer (KIND=4), parameter :: C_INTMAX_T = 8
+    integer (KIND=4), parameter :: C_INTPTR_T = POINTER_LEN
+
+    integer (KIND=4), parameter :: C_FLOAT = 4
+    integer (KIND=4), parameter :: C_DOUBLE = 8
+    integer (KIND=4), parameter :: C_LONG_DOUBLE = C_LONG *2
+
+    integer (KIND=4), parameter :: C_FLOAT_COMPLEX = C_FLOAT
+    integer (KIND=4), parameter :: C_DOUBLE_COMPLEX = C_DOUBLE
+    integer (KIND=4), parameter :: C_LONG_DOUBLE_COMPLEX = C_LONG_DOUBLE
+
+    integer (KIND=4), parameter :: C_BOOL = 1
+
+    integer (KIND=4), parameter :: C_CHAR = 1
+      
+    character (KIND=1, LEN=1), parameter :: C_NULL_CHAR = achar(0)
+    character (KIND=1, LEN=1), parameter :: C_ALERT = achar(7)
+    character (KIND=1, LEN=1), parameter :: C_BACKSPACE = achar(8)
+    character (KIND=1, LEN=1), parameter :: C_FORM_FEED = achar(12)
+    character (KIND=1, LEN=1), parameter :: C_NEW_LINE = achar(10)
+    character (KIND=1, LEN=1), parameter :: C_CARRIAGE_RETURN = achar(13)
+    character (KIND=1, LEN=1), parameter :: C_HORIZONTAL_TAB = achar(9)
+    character (KIND=1, LEN=1), parameter :: C_VERTICAL_TAB = achar(11)
+ 
+    type, BIND(C) :: C_PTR
+        private
+        integer(C_INTPTR_T) :: ptr
+    end type C_PTR
+
+    type, BIND(C) :: C_FUNPTR
+        private
+        integer(C_INTPTR_T) :: ptr
+    end type C_FUNPTR
+
+    type(C_PTR), parameter :: C_NULL_PTR = C_PTR(0)
+    type(C_FUNPTR), parameter :: C_NULL_FUNPTR = C_FUNPTR(0)
+
+    integer(4), parameter, private :: for_desc_max_rank = 7    
+    integer(C_INTPTR_T), parameter, private :: for_desc_array_defined= 1
+    integer(C_INTPTR_T), parameter, private :: for_desc_array_nodealloc = 2
+    integer(C_INTPTR_T), parameter, private :: for_desc_array_contiguous = 4
+    integer(C_INTPTR_T), parameter, private :: for_desc_flags = & 
+                                               for_desc_array_defined + &
+                                               for_desc_array_nodealloc + &
+                                               for_desc_array_contiguous
+
+    type, private :: for_desc_triplet
+        integer(C_INTPTR_T) :: extent
+        integer(C_INTPTR_T) :: mult  ! multiplier for this dimension
+        integer(C_INTPTR_T) :: lowerbound
+    end type for_desc_triplet
+
+    type, private :: for_array_descriptor
+        integer(C_INTPTR_T) :: base
+        integer(C_INTPTR_T) :: len  ! len of data type
+        integer(C_INTPTR_T) :: offset
+        integer(C_INTPTR_T) :: flags
+        integer(C_INTPTR_T) :: rank
+        integer(C_INTPTR_T) :: reserved1
+        type(for_desc_triplet) :: diminfo(for_desc_max_rank)
+    end type for_array_descriptor
+
+    interface c_associated
+        module procedure c_associated_ptr, c_associated_funptr
+    end interface
+
+    interface c_f_pointer
+        module procedure c_f_pointer_scalar
+
+        subroutine c_f_pointer_array1 (cptr, fptr, shape)
+            import :: c_ptr 
+            implicit none
+            type(c_ptr), intent(in) :: cptr
+            integer, POINTER, intent(out) :: fptr(:)
+            integer(1), intent(in) :: shape(:)
+        end subroutine c_f_pointer_array1
+
+        subroutine c_f_pointer_array2 (cptr, fptr, shape)
+            import :: c_ptr
+            implicit none
+            type(c_ptr), intent(in) :: cptr
+            integer, POINTER, intent(out) :: fptr(:)
+            integer(2), intent(in) :: shape(:)
+        end subroutine c_f_pointer_array2
+
+        subroutine c_f_pointer_array4 (cptr, fptr, shape)
+            import :: c_ptr
+            implicit none
+            type(c_ptr), intent(in) :: cptr
+            integer, POINTER, intent(out) :: fptr(:)
+            integer(4), intent(in) :: shape(:)
+        end subroutine c_f_pointer_array4
+
+        subroutine c_f_pointer_array8 (cptr, fptr, shape) 
+            import :: c_ptr
+            implicit none
+            type(c_ptr), intent(in) :: cptr
+            integer, POINTER, intent(out) :: fptr(:)
+            integer(8), intent(in) :: shape(:)
+        end subroutine c_f_pointer_array8
+
+    end interface
+
+    private :: c_f_pointer_private1
+    private :: c_f_pointer_private2
+    private :: c_f_pointer_private4
+    private :: c_f_pointer_private8
+
+CONTAINS
+
+    function c_associated_ptr (c_ptr_1, c_ptr_2)
+        logical(4) :: c_associated_ptr
+        type(c_ptr) :: c_ptr_1
+        type(c_ptr), optional :: c_ptr_2
+    end function c_associated_ptr
+
+    function c_associated_funptr (c_ptr_1, c_ptr_2)
+        logical(4) :: c_associated_funptr
+        type(c_funptr) :: c_ptr_1
+        type(c_funptr), optional :: c_ptr_2
+    end function c_associated_funptr
+
+    subroutine c_f_pointer_scalar (cptr, fptr)
+        integer, POINTER , intent(in):: cptr 
+        integer, POINTER , intent(out):: fptr
+    end subroutine c_f_pointer_scalar
+
+    subroutine c_f_pointer_private1 (caddr, fdesc, shape)
+        integer(C_INTPTR_T), intent(in) :: caddr
+        type(for_array_descriptor), intent(inout) :: fdesc
+        integer(1), intent(in) :: shape(:)
+    end subroutine c_f_pointer_private1
+
+    subroutine c_f_pointer_private2 (caddr, fdesc, shape)
+        integer(C_INTPTR_T), intent(in) :: caddr
+        type(for_array_descriptor), intent(inout) :: fdesc
+        integer(2), intent(in) :: shape(:)
+    end subroutine c_f_pointer_private2
+
+    subroutine c_f_pointer_private4 (caddr, fdesc, shape)
+        integer(C_INTPTR_T), intent(in) :: caddr
+        type(for_array_descriptor), intent(inout) :: fdesc
+        integer(4), intent(in) :: shape(:)
+    end subroutine c_f_pointer_private4
+
+    subroutine c_f_pointer_private8 (caddr, fdesc, shape)
+        integer(C_INTPTR_T), intent(in) :: caddr
+        type(for_array_descriptor), intent(inout) :: fdesc
+        integer(8), intent(in) :: shape(:)
+    end subroutine c_f_pointer_private8
+
+    subroutine c_f_procpointer (cptr, fptr)
+        integer, POINTER , intent(in):: cptr
+        ! TODO remove comment when supported in OMNI
+        !procedure(), POINTER , intent(out):: fptr   
+        integer, POINTER , intent(out):: fptr
+    end subroutine c_f_procpointer
+
+    function c_funloc (x)
+        type(c_funptr) :: c_funloc
+        integer :: x
+    end function c_funloc
+
+    function c_loc (x)
+        type(c_ptr) :: c_loc
+        integer :: x
+    end function c_loc
+
+    function c_sizeof (x)
+        class(*), intent(in) :: x
+        integer(kind=C_SIZE_T) :: c_sizeof
+    end function c_sizeof
+
+end module iso_c_binding
Index: codes/icosagcm/devel/XCodeML/external_src/iso_fortran_env.f90
===================================================================
--- codes/icosagcm/devel/XCodeML/external_src/iso_fortran_env.f90	(revision 823)
+++ codes/icosagcm/devel/XCodeML/external_src/iso_fortran_env.f90	(revision 823)
@@ -0,0 +1,50 @@
+MODULE ISO_FORTRAN_ENV
+  TYPE LOCK_TYPE
+  END type LOCK_TYPE
+  INTEGER, PARAMETER :: ATOMIC_INT_KIND = 8
+  INTEGER, PARAMETER :: ATOMIC_LOGICAL_KIND = 8
+
+  INTEGER, PARAMETER :: CHARACTER_STORAGE_SIZE = 8
+  INTEGER, PARAMETER :: ERROR_UNIT = 0
+  INTEGER, PARAMETER :: FILE_STORAGE_SIZE = 8
+  INTEGER, PARAMETER :: INPUT_UNIT = 5
+  INTEGER, PARAMETER :: IOSTAT_END = -1
+  INTEGER, PARAMETER :: IOSTAT_EOR = -2
+  INTEGER, PARAMETER :: NUMERIC_STORAGE_SIZE = 32
+  INTEGER, PARAMETER :: OUTPUT_UNIT = 6
+  INTEGER, PARAMETER :: IOSTAT_INQUIRE_INTERNAL_UNIT = 99
+    
+  INTEGER, PARAMETER :: INT8 = 1
+  INTEGER, PARAMETER :: INT16 = 2
+  INTEGER, PARAMETER :: INT32 = 4
+  INTEGER, PARAMETER :: INT64 = 8
+  INTEGER, PARAMETER :: LOGICAL8 = 1
+  INTEGER, PARAMETER :: LOGICAL16 = 2
+  INTEGER, PARAMETER :: LOGICAL32 = 4
+  INTEGER, PARAMETER :: LOGICAL64 = 8
+  INTEGER, PARAMETER :: REAL32 = 4
+  INTEGER, PARAMETER :: REAL64 = 8
+  INTEGER, PARAMETER :: REAL128 = 16 
+  INTEGER, PARAMETER :: INTEGER_KINDS(4) = (/INT8, INT16, INT32, INT64/)
+  INTEGER, PARAMETER :: LOGICAL_KINDS(4) = (/LOGICAL8, LOGICAL16, LOGICAL32, LOGICAL64/)
+  INTEGER, PARAMETER :: REAL_KINDS(3) =  (/REAL32, REAL64, REAL128/)
+
+  ! Probably have to be adapted on the fly to the platform
+  ! Just basics ones for a first draft
+  INTEGER, PARAMETER :: C1 = SELECTED_CHAR_KIND('ascii')
+  INTEGER, PARAMETER :: C2 = SELECTED_CHAR_KIND('JIS_0213')
+  INTEGER, PARAMETER :: C3 = SELECTED_CHAR_KIND('UCS_2')
+  INTEGER, PARAMETER :: C4 = SELECTED_CHAR_KIND('ISO_10646')
+  INTEGER, PARAMETER :: CHARACTER_KINDS(4) = (/C1, C2, C3, C4/)
+
+  CONTAINS
+
+  FUNCTION COMPILER_OPTIONS()
+    CHARACTER(LEN=1) :: COMPILER_OPTIONS
+  END FUNCTION COMPILER_OPTIONS
+
+  FUNCTION COMPILER_VERSION()
+    CHARACTER(LEN=1) :: COMPILER_VERSION
+  END FUNCTION COMPILER_VERSION
+
+END MODULE ISO_FORTRAN_ENV
Index: codes/icosagcm/devel/XCodeML/external_src/omp_lib.f90
===================================================================
--- codes/icosagcm/devel/XCodeML/external_src/omp_lib.f90	(revision 823)
+++ codes/icosagcm/devel/XCodeML/external_src/omp_lib.f90	(revision 823)
@@ -0,0 +1,12 @@
+MODULE omp_lib
+  IMPLICIT NONE
+  PUBLIC
+
+  CONTAINS
+    
+    FUNCTION omp_in_parallel()
+      LOGICAL :: omp_in_parallel
+      omp_in_parallel = .TRUE.
+    END FUNCTION omp_in_parallel
+
+END MODULE omp_lib
Index: codes/icosagcm/devel/XCodeML/external_src/xios.f90
===================================================================
--- codes/icosagcm/devel/XCodeML/external_src/xios.f90	(revision 823)
+++ codes/icosagcm/devel/XCodeML/external_src/xios.f90	(revision 823)
@@ -0,0 +1,10 @@
+MODULE xios
+
+  TYPE xios_context
+  END TYPE xios_context
+
+  TYPE xios_duration
+     INTEGER :: second
+  END TYPE xios_duration
+
+END MODULE xios
Index: codes/icosagcm/devel/XCodeML/make_xml.sh
===================================================================
--- codes/icosagcm/devel/XCodeML/make_xml.sh	(revision 823)
+++ codes/icosagcm/devel/XCodeML/make_xml.sh	(revision 823)
@@ -0,0 +1,100 @@
+#!/bin/bash
+
+ROOT=$PWD
+MOD=$ROOT/xmod
+INC=/usr/lib64/openmpi/1.8.8-gfortran49/include
+
+function parse()
+{
+    cd $1 ; shift
+    for SRC in $* ; do
+	F_Front -M $MOD -I $INC $SRC.f90 -o $ROOT/xml/$SRC.xml > $ROOT/xml/$SRC.err 2>&1
+    done
+    cd $ROOT
+}
+
+function add_srcfiles()
+{
+    while (($# > 0)) ; do
+	DIR=$1
+	SRC=$2
+#	echo $SRC ${dir[$SRC]}
+	if [[ -z ${dir[$SRC]} ]] ; then
+#	    echo "add_srcfiles : $NUMFILE $DIR $SRC"
+	    src[$NUMFILE]=$SRC
+	    dir[$SRC]=$DIR
+	    ok[$SRC]=NO
+	    ((NUMFILE++))
+	fi
+	shift ; shift
+    done
+}
+
+NETCDF=netcdf-fortran-4.4.5
+if [ ! -d "$NETCDF" ]; then
+    tar xzvf ${NETCDF}.tar.gz
+fi
+
+rm -f xml/* xmod/*
+echo "Parsing NetCDF ..."
+parse ${NETCDF}/fortran typeSizes netcdf4
+echo "... done."
+
+# create arrays
+declare -a src
+declare -A dir
+declare -A ok 
+NUMFILE=0
+
+# first read from text file parse_order.txt
+touch parse_order.txt
+add_srcfiles $(cat parse_order.txt)
+# then, for completeness and bootstrapping, add files found in relevant places
+for DIR in $(find ../tools/ioipsl ../src ../ppsrc external_src -type d) ; do
+    cd -P $ROOT/$DIR
+    for F90 in $(ls *.f90 2>/dev/null) ;  do
+	SRC=$(echo "$F90" | cut -d'.' -f1)
+	add_srcfiles $DIR $SRC
+    done
+done
+cd $ROOT
+
+echo "$NUMFILE files to be parsed."
+rm -f parse_order.txt
+
+PASS=0
+AGAIN=YES
+
+while [[ "$AGAIN" == "YES" ]] ; do
+    AGAIN=NO
+    ((PASS++))
+    echo "------------------ pass $PASS ------------------"
+    for SRC in ${src[@]} ; do
+	DIR=${dir[$SRC]}
+	YESNO=${ok[$SRC]}
+	if [[ "$YESNO" == "NO" ]] ; then
+	    parse $DIR $SRC
+	    grep 'failed to import module' xml/$SRC.err > /dev/null
+	    if [ $? -ne 0 ]; then
+		echo "$SRC : $DIR/$SRC.f90"
+		echo "$DIR $SRC" >> parse_order.txt
+		ok[$SRC]=YES
+		AGAIN=YES
+	    else
+		rm xml/$SRC.xml
+	    fi
+	fi
+    done
+done
+
+echo "------------------------------------"
+for SRC in ${!dir[@]} ; do
+    DIR=${dir[$SRC]}
+    YESNO=${ok[$SRC]}
+    if [[ "$YESNO" == "NO" ]] ; then
+	echo "Unable to parse : $SRC $DIR/$SRC.f90, check xml/$SRC.err"
+    fi
+done
+
+# cleanup
+find xml -name '*.err' -size 0 -print0 | xargs -0 rm
Index: codes/icosagcm/devel/XCodeML/parse_order.txt
===================================================================
--- codes/icosagcm/devel/XCodeML/parse_order.txt	(revision 823)
+++ codes/icosagcm/devel/XCodeML/parse_order.txt	(revision 823)
@@ -0,0 +1,126 @@
+../tools/ioipsl defprec
+../tools/ioipsl errioipsl
+../tools/ioipsl stringop
+../src/parallel transfert_omp
+../src/base prec
+../src/base profiling
+../src/dcmip dcmip2016_baroclinic_wave
+../src/dcmip dcmip2016_cyclone
+../src/dcmip dcmip2016_kessler_physic
+../src/dcmip dcmip2016_simple_physics
+../src/dcmip dcmip2016_supercell
+../src/dcmip dcmip_initial_conditions_test_1_2_3_v5
+../src/dcmip terminator
+../src/output free_unit_mod
+../ppsrc/base trace
+../ppsrc/output netcdf_mod
+external_src iso_c_binding
+external_src iso_fortran_env
+external_src omp_lib
+external_src xios
+../tools/ioipsl calendar
+../tools/ioipsl getincom
+../tools/ioipsl ioipsl
+../tools/ioipsl mathelp
+../src/parallel domain_param
+../src/base grid_param
+../src/base math_const
+../src/transport tracer
+../ppsrc/parallel mpi_mod
+../ppsrc/parallel omp_para
+../ppsrc/parallel mpipara
+../ppsrc/unstructured data_unstructured
+../ppsrc/unstructured transfer_unstructured
+../ppsrc/unstructured transport_unstructured
+../src/base getin
+../ppsrc/unstructured caldyn_unstructured
+../ppsrc/unstructured diags_unstructured
+../ppsrc/unstructured timestep_unstructured
+../src/base earth_const
+../src/base genmod
+../src/sphere vector
+../src/time time
+../src/sphere spherical_geom
+../src/sphere metric
+../src/parallel domain
+../src/base dimensions
+../src/base field
+../src/unstructured init_unstructured
+../ppsrc/physics physics_external
+../src/parallel transfert_mpi
+../ppsrc/parallel transfert
+../src/sphere geometry
+../src/output write_field
+../ppsrc/output xios_mod
+../src icosa_mod
+../src/parallel checksum
+../src/diagnostics kinetic
+../src/physics dimphys
+../src/physics physics_interface
+../src/dissip nudging_mod
+../src/dynamics caldyn_vars
+../src/initial etat0_temperature
+../src/initial q_sat
+../src/vertical disvert_apbp
+../src/vertical disvert_dcmip200
+../src/vertical disvert_dcmip3
+../src/vertical disvert_ncar
+../src/vertical disvert_ncarl30
+../src/vertical disvert_std
+../src/vertical disvert_strato
+../src/output output_field
+../ppsrc/diagnostics wind
+../ppsrc/transport advect
+../src/dcmip physics_dcmip
+../src/vertical disvert
+../src/transport advect_tracer
+../src/output restart
+../src/output write_etat0
+../ppsrc/diagnostics diagflux
+../ppsrc/dynamics caldyn_kernels_base
+../ppsrc/dynamics caldyn_kernels_hevi
+../src/dcmip guided_ncar_mod
+../src/dcmip physics_dcmip2016
+../src/diagnostics omega
+../src/diagnostics pression
+../src/diagnostics vorticity
+../src/dissip guided_mod
+../src/dynamics caldyn_kernels
+../src/initial etat0_bubble
+../src/initial etat0_dcmip1
+../src/initial etat0_dcmip2016_baroclinic_wave
+../src/initial etat0_dcmip2016_cyclone
+../src/initial etat0_dcmip2016_supercell
+../src/initial etat0_dcmip2
+../src/initial etat0_dcmip3
+../src/initial etat0_dcmip4
+../src/initial etat0_dcmip5
+../src/initial etat0_jablonowsky06
+../src/initial etat0_start_file
+../src/initial etat0_williamson
+../src/time euler_scheme
+../src/vertical vertical_interp
+../src/vertical vertical_remap
+../src/diagnostics exner
+../src/diagnostics theta_rhodz
+../src/dynamics caldyn_adv
+../src/initial etat0_database
+../src/initial etat0_heldsz
+../src/initial etat0_venus
+../src/diagnostics geopotential_mod
+../src/diagnostics observable
+../src/dissip dissip_gcm
+../src/dissip sponge
+../src/dynamics caldyn_hevi
+../src/initial etat0_academic
+../src/initial etat0
+../src/time hevi_scheme
+../ppsrc/physics physics_lmdz_generic
+../ppsrc/dynamics caldyn_gcm
+../src/diagnostics check_conserve
+../src/physics physics
+../src/dynamics caldyn
+../src/time explicit_scheme
+../src/time timeloop_gcm
+../src icosa_init
+../src icosa_gcm
