Index: /codes/icosagcm/trunk/src/base/earth_const.f90
===================================================================
--- /codes/icosagcm/trunk/src/base/earth_const.f90	(revision 898)
+++ /codes/icosagcm/trunk/src/base/earth_const.f90	(revision 899)
@@ -36,5 +36,4 @@
   USE getin_mod
   IMPLICIT NONE
-  REAL(rstd) :: X=1
   
     CALL getin("radius",radius)
Index: /codes/icosagcm/trunk/src/base/profiling.f90
===================================================================
--- /codes/icosagcm/trunk/src/base/profiling.f90	(revision 898)
+++ /codes/icosagcm/trunk/src/base/profiling.f90	(revision 899)
@@ -41,5 +41,4 @@
   SUBROUTINE enter_profile(id)
     INTEGER, INTENT(IN) :: id
-    REAL :: my_chrono
     !$OMP MASTER
     depth = depth+1
Index: /codes/icosagcm/trunk/src/dcmip/dcmip2016_baroclinic_wave.f90
===================================================================
--- /codes/icosagcm/trunk/src/dcmip/dcmip2016_baroclinic_wave.f90	(revision 898)
+++ /codes/icosagcm/trunk/src/dcmip/dcmip2016_baroclinic_wave.f90	(revision 899)
@@ -40,7 +40,6 @@
 !
 !=======================================================================
-
   IMPLICIT NONE
-
+  
 !=======================================================================
 !    Physical constants
@@ -99,5 +98,5 @@
   SUBROUTINE baroclinic_wave_test(deep,moist,pertt,X,lon,lat,p,z,zcoords,u,v,t,thetav,phis,ps,rho,q) &
     BIND(c, name = "baroclinic_wave_test")
- 
+    use iso_c_binding
     IMPLICIT NONE
 
@@ -105,22 +104,22 @@
 !     input/output params parameters at given location
 !-----------------------------------------------------------------------
-    INTEGER, INTENT(IN)  :: &
+    INTEGER(KIND=C_INT32_T), INTENT(IN)  :: &
                 deep,       & ! Deep (1) or Shallow (0) test case
                 moist,      & ! Moist (1) or Dry (0) test case
                 pertt         ! Perturbation type
 
-    REAL(8), INTENT(IN)  :: &
+    REAL(KIND=C_DOUBLE), INTENT(IN)  :: &
                 lon,        & ! Longitude (radians)
                 lat,        & ! Latitude (radians)
                 X             ! Earth scaling parameter
 
-    REAL(8), INTENT(INOUT) :: &
+    REAL(KIND=C_DOUBLE), INTENT(INOUT) :: &
                 p,            & ! Pressure (Pa)
                 z               ! Altitude (m)
 
-    INTEGER, INTENT(IN) :: zcoords     ! 1 if z coordinates are specified
+    INTEGER(KIND=C_INT32_T), INTENT(IN) :: zcoords     ! 1 if z coordinates are specified
                                        ! 0 if p coordinates are specified
 
-    REAL(8), INTENT(OUT) :: &
+    REAL(KIND=C_DOUBLE), INTENT(OUT) :: &
                 u,          & ! Zonal wind (m s^-1)
                 v,          & ! Meridional wind (m s^-1)
@@ -138,5 +137,5 @@
     REAL(8) :: T0, constH, constC, scaledZ, inttau2, rratio
     REAL(8) :: inttermU, bigU, rcoslat, omegarcoslat
-    REAL(8) :: eta, qratio, qnum, qden
+    REAL(8) :: eta
 
     !------------------------------------------------
Index: /codes/icosagcm/trunk/src/dcmip/dcmip2016_cyclone.f90
===================================================================
--- /codes/icosagcm/trunk/src/dcmip/dcmip2016_cyclone.f90	(revision 898)
+++ /codes/icosagcm/trunk/src/dcmip/dcmip2016_cyclone.f90	(revision 899)
@@ -95,5 +95,5 @@
   SUBROUTINE tropical_cyclone_test(lon,lat,p,z,zcoords,u,v,t,thetav,phis,ps,rho,q) &
     BIND(c, name = "tropical_cyclone_test")
-
+    use iso_c_binding
     IMPLICIT NONE
 
@@ -102,16 +102,16 @@
     !------------------------------------------------
 
-    REAL(8), INTENT(IN) ::     &
+    REAL(KIND=C_DOUBLE), INTENT(IN) ::     &
               lon,             &     ! Longitude (radians)
               lat                    ! Latitude (radians)
 
-    REAL(8), INTENT(INOUT) ::  &
+    REAL(KIND=C_DOUBLE), INTENT(INOUT) ::  &
               p,               &     ! Pressure (Pa)
               z                      ! Height (m)
 
-    INTEGER, INTENT(IN) :: zcoords     ! 1 if z coordinates are specified
+    INTEGER(KIND=C_INT32_T), INTENT(IN) :: zcoords     ! 1 if z coordinates are specified
                                      ! 0 if p coordinates are specified
 
-    REAL(8), INTENT(OUT) ::    &
+    REAL(KIND=C_DOUBLE), INTENT(OUT) ::    &
               u,               &     ! Zonal wind (m s^-1)
               v,               &     ! Meridional wind (m s^-1)
Index: /codes/icosagcm/trunk/src/dcmip/dcmip2016_supercell.f90
===================================================================
--- /codes/icosagcm/trunk/src/dcmip/dcmip2016_supercell.f90	(revision 898)
+++ /codes/icosagcm/trunk/src/dcmip/dcmip2016_supercell.f90	(revision 899)
@@ -148,8 +148,5 @@
 
     ! Variables for calculation of equatorial profile
-    REAL(8) :: exnereqs, p, T, qvs, qv
-
-    ! Error metric
-    REAL(8) :: err
+    REAL(8) :: exnereqs, p, T, qvs
 
     ! Loop indices
@@ -349,5 +346,5 @@
   SUBROUTINE supercell_test(lon,lat,p,z,zcoords,u,v,t,thetav,ps,rho,q,pert) &
     BIND(c, name = "supercell_test")
- 
+    use iso_c_binding
     IMPLICIT NONE
 
@@ -355,16 +352,16 @@
     !   Input / output parameters
     !------------------------------------------------
-    REAL(8), INTENT(IN)  :: &
+    REAL(KIND=c_double), INTENT(IN)  :: &
                 lon,        & ! Longitude (radians)
                 lat           ! Latitude (radians)
 
-    REAL(8), INTENT(INOUT) :: &
+    REAL(KIND=c_double), INTENT(INOUT) :: &
                 p,            & ! Pressure (Pa)
                 z               ! Altitude (m)
 
-    INTEGER, INTENT(IN) :: zcoords     ! 1 if z coordinates are specified
+    INTEGER(KIND=c_int32_t), INTENT(IN) :: zcoords     ! 1 if z coordinates are specified
                                        ! 0 if p coordinates are specified
 
-    REAL(8), INTENT(OUT) :: &
+    REAL(KIND=c_double), INTENT(OUT) :: &
                 u,          & ! Zonal wind (m s^-1)
                 v,          & ! Meridional wind (m s^-1)
@@ -375,5 +372,5 @@
                 q             ! water vapor mixing ratio (kg/kg)
 
-    INTEGER, INTENT(IN) :: pert  ! 1 if perturbation should be included
+    INTEGER(KIND=c_int32_t), INTENT(IN) :: pert  ! 1 if perturbation should be included
                                  ! 0 if no perturbation should be included
 
Index: /codes/icosagcm/trunk/src/dcmip/dcmip_initial_conditions_test_1_2_3_v5.f90
===================================================================
--- /codes/icosagcm/trunk/src/dcmip/dcmip_initial_conditions_test_1_2_3_v5.f90	(revision 898)
+++ /codes/icosagcm/trunk/src/dcmip/dcmip_initial_conditions_test_1_2_3_v5.f90	(revision 899)
@@ -140,5 +140,5 @@
       real(rstd) :: ptop							! Model top in p
       real(rstd) :: sin_tmp, cos_tmp, sin_tmp2, cos_tmp2			! Calculate great circle distances
-      real(rstd) :: d1, d2, r, r2, d3, d4					! For tracer calculations 
+      real(rstd) :: d1, d2, r, r2					! For tracer calculations 
       real(rstd) :: s, bs							! Shape function, and parameter
       real(rstd) :: lonp							! Translational longitude, depends on time
Index: /codes/icosagcm/trunk/src/dcmip/guided_ncar_mod.f90
===================================================================
--- /codes/icosagcm/trunk/src/dcmip/guided_ncar_mod.f90	(revision 898)
+++ /codes/icosagcm/trunk/src/dcmip/guided_ncar_mod.f90	(revision 899)
@@ -38,5 +38,4 @@
     REAL(rstd), INTENT(IN):: tt
     TYPE(t_field),POINTER :: f_ps(:)
-    TYPE(t_field),POINTER :: f_phis(:)
     TYPE(t_field),POINTER :: f_theta_rhodz(:)
     TYPE(t_field),POINTER :: f_u(:)  
@@ -63,8 +62,5 @@
     REAL(rstd),INTENT(IN)  :: tt ! current time 
     REAL(rstd),INTENT(OUT) :: ue(iim*3*jjm,llm)
-    REAL(rstd) :: lon, lat
     REAL(rstd) :: nx(3),n_norm,Velocity(3,llm)
-    REAL(rstd) :: rr1,rr2,bb,cc,aa,hmx
-    REAL(rstd) :: v1(3),v2(3),ny(3)
     INTEGER :: i,j,n,l
     REAL(rstd) :: pitbytau,kk, pr, zr, u0, u1, v0
Index: /codes/icosagcm/trunk/src/dcmip/physics_dcmip.f90
===================================================================
--- /codes/icosagcm/trunk/src/dcmip/physics_dcmip.f90	(revision 898)
+++ /codes/icosagcm/trunk/src/dcmip/physics_dcmip.f90	(revision 899)
@@ -5,7 +5,4 @@
   INTEGER,SAVE :: testcase
 !$OMP THREADPRIVATE(testcase)
-
-  TYPE(t_field),POINTER :: f_out_i(:)
-  REAL(rstd),POINTER :: out_i(:,:)
 
   TYPE(t_field),POINTER  :: f_precl(:)
Index: /codes/icosagcm/trunk/src/dcmip/physics_dcmip2016.f90
===================================================================
--- /codes/icosagcm/trunk/src/dcmip/physics_dcmip2016.f90	(revision 898)
+++ /codes/icosagcm/trunk/src/dcmip/physics_dcmip2016.f90	(revision 899)
@@ -5,7 +5,4 @@
   INTEGER,SAVE :: testcase
 !$OMP THREADPRIVATE(testcase)
-
-  TYPE(t_field),SAVE,POINTER :: f_out_i(:)
-  REAL(rstd),SAVE,POINTER :: out_i(:,:)
 
   TYPE(t_field),SAVE,POINTER  :: f_precl(:)
Index: /codes/icosagcm/trunk/src/diagnostics/check_conserve.f90
===================================================================
--- /codes/icosagcm/trunk/src/diagnostics/check_conserve.f90	(revision 898)
+++ /codes/icosagcm/trunk/src/diagnostics/check_conserve.f90	(revision 899)
@@ -17,6 +17,6 @@
        AAM_mass_source(3), AAM_vel_source(3) ! read/written only IF is_master
   REAL(rstd),SAVE :: AAM_vel_plus_source(3), AAM_vel_minus_source(3)
-  REAL(rstd),SAVE :: mtot0,ztot0,etot0,angtot0,stot0,rmsvtot0
-  !$OMP THREADPRIVATE(check_type, mtot0,ztot0,etot0,angtot0,stot0,rmsvtot0)
+  REAL(rstd),SAVE :: mtot0,ztot0,etot0,angtot0,stot0
+  !$OMP THREADPRIVATE(check_type, mtot0,ztot0,etot0,angtot0,stot0)
   
   PUBLIC :: init_check_conserve, check_conserve_detailed, check_conserve
@@ -66,5 +66,5 @@
 
     REAL(rstd),POINTER :: p(:,:),rhodz(:,:) 
-    INTEGER :: ind,ierr
+    INTEGER :: ind
     REAL(rstd) :: mtot, angtot, rmsdpdt
     REAL(rstd) :: etot, stot, ang_mass, ang_vel, ang_velp, ang_velm, rmsvtot, ztot
@@ -171,6 +171,6 @@
 
     REAL(rstd),POINTER :: p(:,:),rhodz(:,:) 
-    INTEGER::ind,ierr
-    REAL(rstd) :: mtot, ztot, rmsdpdt, etot,stot,rmsv, ang_mass, ang_vel, ang_velp, ang_velm
+    INTEGER::ind
+    REAL(rstd) ::  etot,stot,rmsv, ang_mass, ang_vel, ang_velp, ang_velm
     
     IF(check_type == check_detailed) THEN
@@ -246,5 +246,4 @@
     INTEGER :: ind,i,j,ij  
     REAL :: mloc, rmsloc
-    REAL :: mloc_mpi, rmsloc_mpi
 
     mloc=0.0; rmsloc=0.0
@@ -378,5 +377,5 @@
     REAL(rstd), POINTER :: rhodz(:,:) 
     INTEGER :: ind
-    REAL(rstd) :: z,z_mpi
+    REAL(rstd) :: z
     
     z=0
@@ -400,5 +399,5 @@
     REAL(rstd)::qv1,qv2 
     REAL(rstd)::hv1,hv2  
-    INTEGER :: i,j,ij,l,ij2
+    INTEGER :: i,j,ij,l
 
     hv1 = 0.0 ; hv2 = 0.0 
Index: /codes/icosagcm/trunk/src/diagnostics/geopotential_mod.f90
===================================================================
--- /codes/icosagcm/trunk/src/diagnostics/geopotential_mod.f90	(revision 898)
+++ /codes/icosagcm/trunk/src/diagnostics/geopotential_mod.f90	(revision 899)
@@ -13,5 +13,5 @@
     TYPE(t_field), POINTER :: f_ps(:), f_phis(:), f_theta_rhodz(:), &  ! IN                                       
          f_p(:), f_theta(:), f_phi(:)               ! OUT                                                         
-    REAL(rstd),POINTER :: pk(:,:), p(:,:), theta(:,:,:), theta_rhodz(:,:,:), &
+    REAL(rstd),POINTER :: p(:,:), theta(:,:,:), theta_rhodz(:,:,:), &
          phi(:,:), phis(:), ps(:)
     INTEGER :: ind
Index: /codes/icosagcm/trunk/src/diagnostics/kinetic.f90
===================================================================
--- /codes/icosagcm/trunk/src/diagnostics/kinetic.f90	(revision 898)
+++ /codes/icosagcm/trunk/src/diagnostics/kinetic.f90	(revision 899)
@@ -134,5 +134,5 @@
     REAL(rstd),INTENT(OUT):: Ki(iim*jjm,llm)
     REAL(rstd) :: Kv(2*iim*jjm,llm)
-    INTEGER :: ij,l, u_up, u_down
+    INTEGER :: ij,l
     
     CALL compute_kv(ue,Kv)
Index: /codes/icosagcm/trunk/src/diagnostics/observable.f90
===================================================================
--- /codes/icosagcm/trunk/src/diagnostics/observable.f90	(revision 898)
+++ /codes/icosagcm/trunk/src/diagnostics/observable.f90	(revision 899)
@@ -230,5 +230,5 @@
     INTEGER :: ij,l
     REAL(rstd) :: F_el(3*iim*jjm,llm+1)
-    REAL(rstd) :: uu_right, uu_lup, uu_ldown, W_el, DePhil
+    REAL(rstd) :: W_el, DePhil
     ! NB : u and uh are not in DEC form, they are normal components    
     ! => we must divide by de
Index: /codes/icosagcm/trunk/src/dissip/dissip_gcm.f90
===================================================================
--- /codes/icosagcm/trunk/src/dissip/dissip_gcm.f90	(revision 898)
+++ /codes/icosagcm/trunk/src/dissip/dissip_gcm.f90	(revision 899)
@@ -84,6 +84,4 @@
   CHARACTER(len=255)    :: rayleigh_friction_key
   REAL(rstd)            :: mintau
-  INTEGER               :: seed_size
-  INTEGER,ALLOCATABLE   :: seed(:)
   
   ! New variables added for dissipation vertical profile (SF, 19/09/18)
@@ -592,5 +590,5 @@
       SUBROUTINE relax(shift_t, shift_u)
         USE dcmip_initial_conditions_test_1_2_3
-        REAL(rstd) :: z, ulon,ulat, lon,lat, & ! input to test2_schaer_mountain
+        REAL(rstd) :: z, ulon,ulat, & ! input to test2_schaer_mountain
              p,hyam,hybm,w,t,phis,ps,rho,q, &   ! unused input/output to test2_schaer_mountain
              fz, u3d(3), uref
Index: /codes/icosagcm/trunk/src/dissip/guided_mod.f90
===================================================================
--- /codes/icosagcm/trunk/src/dissip/guided_mod.f90	(revision 898)
+++ /codes/icosagcm/trunk/src/dissip/guided_mod.f90	(revision 899)
@@ -35,5 +35,4 @@
     REAL(rstd), INTENT(IN):: tt
     TYPE(t_field),POINTER :: f_ps(:)
-    TYPE(t_field),POINTER :: f_phis(:)
     TYPE(t_field),POINTER :: f_theta_rhodz(:)
     TYPE(t_field),POINTER :: f_u(:)  
Index: /codes/icosagcm/trunk/src/dynamics/caldyn.f90
===================================================================
--- /codes/icosagcm/trunk/src/dynamics/caldyn.f90	(revision 898)
+++ /codes/icosagcm/trunk/src/dynamics/caldyn.f90	(revision 899)
@@ -3,5 +3,5 @@
   PRIVATE
   SAVE
-  CHARACTER(LEN=255),SAVE :: caldyn_type
+  CHARACTER(LEN=255) :: caldyn_type
 !$OMP THREADPRIVATE(caldyn_type)
  
Index: /codes/icosagcm/trunk/src/dynamics/caldyn_adv.f90
===================================================================
--- /codes/icosagcm/trunk/src/dynamics/caldyn_adv.f90	(revision 898)
+++ /codes/icosagcm/trunk/src/dynamics/caldyn_adv.f90	(revision 899)
@@ -118,5 +118,4 @@
 
     INTEGER :: i,j,ij,l    
-    LOGICAL,SAVE :: first=.TRUE.
 
     ALLOCATE(rhodz(iim*jjm,llm))
Index: /codes/icosagcm/trunk/src/dynamics/caldyn_gcm.F90
===================================================================
--- /codes/icosagcm/trunk/src/dynamics/caldyn_gcm.F90	(revision 898)
+++ /codes/icosagcm/trunk/src/dynamics/caldyn_gcm.F90	(revision 899)
@@ -144,5 +144,5 @@
     REAL(rstd),POINTER  :: wwuu(:,:)
 
-    INTEGER :: ind,i,j,ij,l
+    INTEGER :: ind,ij
 
     IF (is_omp_first_level) THEN
Index: /codes/icosagcm/trunk/src/dynamics/caldyn_kernels.f90
===================================================================
--- /codes/icosagcm/trunk/src/dynamics/caldyn_kernels.f90	(revision 898)
+++ /codes/icosagcm/trunk/src/dynamics/caldyn_kernels.f90	(revision 899)
@@ -15,5 +15,4 @@
     REAL(rstd) :: ulon(iim*3*jjm)
     REAL(rstd) :: ulat(iim*3*jjm)
-    REAL(rstd) :: lon,lat
     INTEGER :: ij
     DO ij=ij_begin_ext,ij_end_ext
@@ -44,5 +43,5 @@
     REAL(rstd),INTENT(OUT) :: qv(iim*2*jjm,llm)
 
-    INTEGER :: i,j,ij,l
+    INTEGER :: ij,l
     REAL(rstd) :: etav,hv, m
     CALL trace_start("compute_pvort")  
@@ -130,12 +129,12 @@
     REAL(rstd),INTENT(OUT) :: du(iim*3*jjm,llm)
 
-    REAL(rstd) :: cor_NT(iim*jjm,llm)  ! NT coriolis force u.(du/dPhi)
-    REAL(rstd) :: urel(3*iim*jjm,llm)  ! relative velocity
+    !REAL(rstd) :: cor_NT(iim*jjm,llm)  ! NT coriolis force u.(du/dPhi)
+    !REAL(rstd) :: urel(3*iim*jjm,llm)  ! relative velocity
     REAL(rstd) :: Ftheta(3*iim*jjm,llm) ! theta flux
     REAL(rstd) :: berni(iim*jjm,llm)  ! Bernoulli function
     REAL(rstd) :: uu_right, uu_lup, uu_ldown
 
-    INTEGER :: i,j,ij,l
-    REAL(rstd) :: ww,uu
+    INTEGER :: ij,l
+    REAL(rstd) :: uu
 
     CALL trace_start("compute_caldyn_horiz")
Index: /codes/icosagcm/trunk/src/dynamics/caldyn_kernels_base.F90
===================================================================
--- /codes/icosagcm/trunk/src/dynamics/caldyn_kernels_base.F90	(revision 898)
+++ /codes/icosagcm/trunk/src/dynamics/caldyn_kernels_base.F90	(revision 899)
@@ -10,6 +10,4 @@
   INTEGER, PARAMETER,PUBLIC :: energy=1, enstrophy=2
   TYPE(t_field),POINTER,PUBLIC :: f_out_u(:), f_qu(:), f_qv(:)
-  REAL(rstd),SAVE,POINTER :: out_u(:,:), p(:,:), qu(:,:)
-  !$OMP THREADPRIVATE(out_u, p, qu)
 
   ! temporary shared variables for caldyn
@@ -35,5 +33,5 @@
     REAL(rstd),INTENT(INOUT) :: geopot(iim*jjm,llm+1) ! geopotential
 
-    INTEGER :: i,j,ij,l
+    INTEGER :: ij,l
     REAL(rstd) :: Rd, p_ik, exner_ik, temp_ik, qv, chi, Rmix, gv
     INTEGER    :: ij_omp_begin_ext, ij_omp_end_ext
@@ -182,6 +180,5 @@
 
     ! temporary variable    
-    INTEGER :: i,j,ij,l,iq
-    REAL(rstd) :: p_ik, exner_ik
+    INTEGER ::ij,l,iq
     INTEGER    :: ij_omp_begin, ij_omp_end
 
Index: /codes/icosagcm/trunk/src/dynamics/caldyn_kernels_hevi.F90
===================================================================
--- /codes/icosagcm/trunk/src/dynamics/caldyn_kernels_hevi.F90	(revision 898)
+++ /codes/icosagcm/trunk/src/dynamics/caldyn_kernels_hevi.F90	(revision 899)
@@ -117,6 +117,6 @@
     REAL(rstd) :: C_ik(iim*jjm,llm)      ! Thomas algorithm
     REAL(rstd) :: D_il(iim*jjm,llm+1)    ! Thomas algorithm
-    REAL(rstd) :: gamma, rho_ij, X_ij, Y_ij
-    REAL(rstd) :: wil, tau2_g, g2, gm2, ml_g2, c2_mik
+    REAL(rstd) :: gamma, rho_ij, X_ij
+    REAL(rstd) :: tau2_g, g2, gm2, ml_g2, c2_mik
 
     INTEGER    :: iter, ij, l, ij_omp_begin_ext, ij_omp_end_ext
@@ -133,5 +133,5 @@
     tau2_g=tau*tau/g
     g2=g*g
-    gm2 = g**-2
+    gm2 = g**(-2)
     gamma = 1./(1.-kappa)
     
@@ -256,5 +256,5 @@
           PRINT *, '[hevi_solver] C,D', iter, MAXVAL(ABS(C_ik)),MAXVAL(ABS(D_il))
           DO l=1,llm+1
-             WRITE(*,'(A,I2.1,I3.2,E9.2)'), '[hevi_solver] x', iter,l, MAXVAL(ABS(x_il(:,l)))
+             WRITE(*,'(A,I2.1,I3.2,E9.2)') '[hevi_solver] x', iter,l, MAXVAL(ABS(x_il(:,l)))
           END DO
        END IF
@@ -282,5 +282,5 @@
     REAL(rstd) :: berni(iim*jjm,llm)         ! (W/m_il)^2
     REAL(rstd) :: berni1(iim*jjm)         ! (W/m_il)^2
-    REAL(rstd) :: gamma, rho_ij, T_ij, X_ij, Y_ij, vreff, Rd, Cvd
+    REAL(rstd) :: gamma, rho_ij, T_ij, X_ij, vreff, Rd, Cvd
     INTEGER    :: ij, l
 
@@ -401,5 +401,5 @@
     REAL(rstd) :: berniv(iim*jjm,llm)  ! moist Bernoulli function
 
-    INTEGER :: i,j,ij,l
+    INTEGER :: ij,l
     REAL(rstd) :: Rd, qv, temp, chi, nu, due, due_right, due_lup, due_ldown
 
@@ -525,5 +525,5 @@
     REAL(rstd) :: Ftheta(3*iim*jjm,llm)  ! potential temperature flux
     REAL(rstd) :: uu_right, uu_lup, uu_ldown, du_trisk, divF
-    INTEGER :: ij,iq,l,kdown
+    INTEGER :: ij,iq,l
 
     CALL trace_start("compute_caldyn_Coriolis")
Index: /codes/icosagcm/trunk/src/icosa_init.f90
===================================================================
--- /codes/icosagcm/trunk/src/icosa_init.f90	(revision 898)
+++ /codes/icosagcm/trunk/src/icosa_init.f90	(revision 899)
@@ -85,9 +85,6 @@
     IMPLICIT NONE
     TYPE(t_field),POINTER,SAVE :: sum_ne(:)
-    TYPE(t_field),POINTER,SAVE :: sum_ne_glo(:)
     REAL(rstd),POINTER :: pt_sum_ne(:)
-    INTEGER :: ind,i,j,k,n
-    REAL(rstd) :: vect(3,6)
-    REAL(rstd) :: centr(3),dist    
+    INTEGER :: ind,i,j,k,n 
     REAL(rstd) :: tot_sum=0
 
Index: /codes/icosagcm/trunk/src/initial/etat0.f90
===================================================================
--- /codes/icosagcm/trunk/src/initial/etat0.f90	(revision 898)
+++ /codes/icosagcm/trunk/src/initial/etat0.f90	(revision 899)
@@ -66,5 +66,4 @@
 
   SUBROUTINE etat0(f_ps,f_mass,f_phis,f_theta_rhodz,f_u, f_geopot,f_w, f_q)
-    USE mpipara, ONLY : is_mpi_root
     USE disvert_mod
     ! Generic interface
@@ -96,6 +95,6 @@
     
     REAL(rstd),POINTER :: ps(:), mass(:,:)
-    LOGICAL :: autoinit_mass, autoinit_geopot, collocated
-    INTEGER :: ind,i,j,ij,l
+    LOGICAL :: autoinit_mass, collocated
+    INTEGER :: ind
 
     ! most etat0 routines set ps and not mass
@@ -248,5 +247,5 @@
 
     REAL(rstd) :: p(iim*jjm,llm+1)
-    REAL(rstd) :: cppd,Rd, mass, p_ij, q_ij,r_ij, chi,nu, entropy, theta
+    REAL(rstd) :: cppd,Rd, mass, p_ij, chi,nu, entropy, theta
     INTEGER :: i,j,ij,l
 
@@ -323,5 +322,5 @@
     REAL(rstd) :: q_e(3*iim*jjm,llm,nqtot)
 
-    INTEGER :: l,i,j,ij
+    INTEGER :: l,ij
     REAL :: p_ik, v_ik, mass_ik
     LOGICAL :: autoinit_mass, autoinit_NH
Index: /codes/icosagcm/trunk/src/initial/etat0_academic.f90
===================================================================
--- /codes/icosagcm/trunk/src/initial/etat0_academic.f90	(revision 898)
+++ /codes/icosagcm/trunk/src/initial/etat0_academic.f90	(revision 899)
@@ -19,8 +19,4 @@
     TYPE(t_field),POINTER,SAVE :: f_Ki(:)
     TYPE(t_field),POINTER,SAVE :: f_temp(:)
-  
-    REAL(rstd),POINTER :: Ki(:,:)
-    REAL(rstd),POINTER :: temp(:)
-    INTEGER :: ind
         
     CALL allocate_field(f_ps,field_t,type_real)
@@ -92,9 +88,6 @@
   REAL(rstd) :: ddsin
   REAL(rstd) :: thetarappel
-  REAL(rstd) :: lon,lat
+  REAL(rstd) :: lat
   REAL(rstd) :: p(iim*jjm,llm+1)
-  REAL(rstd) :: alpha(iim*jjm,llm),beta(iim*jjm,llm)
-  REAL(rstd) :: delta
-  REAL(rstd) :: pks(iim*jjm),pk(iim*jjm,llm)
   REAL(rstd) :: phi(iim*jjm,llm)
   REAL(rstd) :: x  
Index: /codes/icosagcm/trunk/src/initial/etat0_dcmip1.f90
===================================================================
--- /codes/icosagcm/trunk/src/initial/etat0_dcmip1.f90	(revision 898)
+++ /codes/icosagcm/trunk/src/initial/etat0_dcmip1.f90	(revision 899)
@@ -15,17 +15,7 @@
 !$OMP THREADPRIVATE(lon0)
   REAL(rstd), SAVE  :: lat0=0.0
-!$OMP THREADPRIVATE(lat0)
-  REAL(rstd), SAVE  :: alpha=0.0
-!$OMP THREADPRIVATE(alpha)
+  !$OMP THREADPRIVATE(lat0)
   REAL(rstd), SAVE  :: R0 
 !$OMP THREADPRIVATE(R0)
-  REAL(rstd), SAVE  :: lat1=0.
-!$OMP THREADPRIVATE(lat1)
-  REAL(rstd), SAVE  :: lat2=0.
-!$OMP THREADPRIVATE(lat2)
-  REAL(rstd), SAVE  :: lon1=pi/6
-!$OMP THREADPRIVATE(lon1)
-  REAL(rstd), SAVE  :: lon2=-pi/6
-!$OMP THREADPRIVATE(lon2)
   REAL(rstd), SAVE  :: latc1=0.
 !$OMP THREADPRIVATE(latc1)
@@ -113,5 +103,5 @@
   REAL(rstd) :: pr
   !  REAL(rstd) :: lon, lat
-  INTEGER :: n,l
+  INTEGER :: l
   
   DO l=1, llm+1
@@ -158,5 +148,5 @@
     SUBROUTINE cosine_bell_1(hx)
     REAL(rstd) :: hx(ngrid,llm)
-    REAL(rstd) :: rr1,rr2   
+    REAL(rstd) :: rr1 
     INTEGER :: n,l
     DO l=ll_begin,ll_end 
@@ -241,5 +231,5 @@
       REAL(rstd)::hx(ngrid,llm) 
       REAL(rstd),PARAMETER:: zz1=2000.,zz2=5000.,zz0=0.5*(zz1+zz2)
-      INTEGER :: n,l
+      INTEGER :: l
       
       DO l=ll_begin,ll_end
Index: /codes/icosagcm/trunk/src/initial/etat0_dcmip2.f90
===================================================================
--- /codes/icosagcm/trunk/src/initial/etat0_dcmip2.f90	(revision 898)
+++ /codes/icosagcm/trunk/src/initial/etat0_dcmip2.f90	(revision 899)
@@ -60,16 +60,16 @@
     REAL(rstd), INTENT(IN) :: hyam, hybm, lon, lat
     REAL(rstd), INTENT(OUT) :: psj,phisj,tempj,ulonj,ulatj
-    REAL :: dummy
-    dummy=0.
+    REAL :: dummy_p, dummy_z, dummy_w, dummy_rho, dummy_q
+    dummy_p=0;dummy_z=0;dummy_w=0;dummy_rho=0;dummy_q=0
     SELECT CASE (testcase)
     CASE(mountain)
-       CALL test2_steady_state_mountain(lon,lat,dummy,dummy,0,.TRUE.,hyam,hybm, &
-            ulonj,ulatj,dummy,tempj,phisj,psj,dummy,dummy)
+       CALL test2_steady_state_mountain(lon,lat,dummy_p,dummy_z,0,.TRUE.,hyam,hybm, &
+            ulonj,ulatj,dummy_w,tempj,phisj,psj,dummy_rho,dummy_q)
     CASE(schaer_noshear)
-       CALL test2_schaer_mountain(lon,lat,dummy,dummy,0,.TRUE.,hyam,hybm,0,&
-            ulonj,ulatj,dummy,tempj,phisj,psj,dummy,dummy)
+       CALL test2_schaer_mountain(lon,lat,dummy_p,dummy_z,0,.TRUE.,hyam,hybm,0,&
+            ulonj,ulatj,dummy_w,tempj,phisj,psj,dummy_rho,dummy_q)
     CASE(schaer_shear)
-       CALL test2_schaer_mountain(lon,lat,dummy,dummy,0,.TRUE.,hyam,hybm,1, &
-            ulonj,ulatj,dummy,tempj,phisj,psj,dummy,dummy)
+       CALL test2_schaer_mountain(lon,lat,dummy_p,dummy_z,0,.TRUE.,hyam,hybm,1, &
+            ulonj,ulatj,dummy_w,tempj,phisj,psj,dummy_rho,dummy_q)
     END SELECT
   END SUBROUTINE comp_all
Index: /codes/icosagcm/trunk/src/initial/etat0_dcmip2016_baroclinic_wave.f90
===================================================================
--- /codes/icosagcm/trunk/src/initial/etat0_dcmip2016_baroclinic_wave.f90	(revision 898)
+++ /codes/icosagcm/trunk/src/initial/etat0_dcmip2016_baroclinic_wave.f90	(revision 899)
@@ -2,8 +2,5 @@
   USE icosa
   IMPLICIT NONE
-  PRIVATE
- 
-  INTEGER,SAVE :: testcase
-  !$OMP THREADPRIVATE(testcase)  
+  PRIVATE 
   
   INTEGER :: perturbation
@@ -18,5 +15,4 @@
     USE tracer_mod
     IMPLICIT NONE
-    LOGICAL :: is_moist
     CHARACTER(LEN=255) :: str_perturbation
     
Index: /codes/icosagcm/trunk/src/initial/etat0_dcmip3.f90
===================================================================
--- /codes/icosagcm/trunk/src/initial/etat0_dcmip3.f90	(revision 898)
+++ /codes/icosagcm/trunk/src/initial/etat0_dcmip3.f90	(revision 899)
@@ -22,10 +22,12 @@
     REAL(rstd), INTENT(OUT) :: q(ngrid,llm,nqtot)
     REAL(rstd),PARAMETER :: Peq=1e5        ! Reference surface pressure at the equator (hPa)
-    REAL(rstd) :: dummy, pp, zz
+    REAL(rstd) :: dummy_z, dummy_u, dummy_v, dummy_w, dummy_t, dummy_phis, dummy_ps, dummy_rho, dummy_q
+    REAL(rstd) :: pp, zz
     INTEGER :: l,ij
+    dummy_z=0;dummy_u=0;dummy_v=0;dummy_w=0;dummy_t=0;dummy_phis=0;dummy_ps=0;dummy_rho=0;dummy_q=0;
     pp=peq
     DO ij=1,ngrid
-       CALL test3_gravity_wave(scale_factor, lon(ij),lat(ij),pp,dummy,0, &
-            dummy,dummy,dummy,dummy,phis(ij),ps(ij),dummy,dummy)
+       CALL test3_gravity_wave(scale_factor, lon(ij),lat(ij),pp,dummy_z,0, &
+            dummy_u,dummy_v,dummy_w,dummy_t,phis(ij),ps(ij),dummy_rho,dummy_q)
     END DO
     DO l=ll_begin,ll_endp1
@@ -33,5 +35,5 @@
           pp = ap(l) + bp(l)*ps(ij) ! half-layer pressure
           CALL test3_gravity_wave(scale_factor, lon(ij),lat(ij),pp,zz,0, &
-               dummy,dummy,dummy,dummy,dummy,dummy,dummy,dummy)
+               dummy_u,dummy_v,dummy_w,dummy_t,dummy_phis,dummy_ps,dummy_rho,dummy_q)
           geopot(ij,l) = g*zz ! initialize geopotential for NH
        END DO
@@ -40,6 +42,6 @@
        DO ij=1,ngrid
           pp = .5*(ap(l)+ap(l+1)) + .5*(bp(l)+bp(l+1))*ps(ij) ! full-layer pressure
-          CALL test3_gravity_wave(scale_factor, lon(ij),lat(ij),pp,dummy,0, &
-               ulon(ij,l),ulat(ij,l),dummy,Temp(ij,l),dummy,dummy,dummy,dummy)
+          CALL test3_gravity_wave(scale_factor, lon(ij),lat(ij),pp,dummy_z,0, &
+               ulon(ij,l),ulat(ij,l),dummy_w,Temp(ij,l),dummy_phis,dummy_ps,dummy_rho,dummy_q)
        END DO
        q(:,l,:)=0.
Index: /codes/icosagcm/trunk/src/initial/etat0_dcmip4.f90
===================================================================
--- /codes/icosagcm/trunk/src/initial/etat0_dcmip4.f90	(revision 898)
+++ /codes/icosagcm/trunk/src/initial/etat0_dcmip4.f90	(revision 899)
@@ -52,5 +52,5 @@
     INTEGER :: l,ij
     REAL(rstd) :: etal, etavl, etas, etavs, sinlat, coslat, &
-         Y, Tave, T, phis_ave, vort, r2, utot, &
+         Y, Tave, T, phis_ave, vort, utot, &
          dthetaodeta_ave, dthetaodeta, dthetaodlat, duodeta, K, r
     
Index: /codes/icosagcm/trunk/src/initial/etat0_heldsz.f90
===================================================================
--- /codes/icosagcm/trunk/src/initial/etat0_heldsz.f90	(revision 898)
+++ /codes/icosagcm/trunk/src/initial/etat0_heldsz.f90	(revision 899)
@@ -8,13 +8,13 @@
   TYPE(t_field),POINTER :: f_theta(:)
 
-  REAL(rstd),ALLOCATABLE,SAVE :: knewt_t(:),kfrict(:)
+  REAL(rstd),ALLOCATABLE :: knewt_t(:),kfrict(:)
 !$OMP THREADPRIVATE(knewt_t,kfrict)
-  LOGICAL, SAVE :: done=.FALSE.
+  LOGICAL :: done=.FALSE.
 !$OMP THREADPRIVATE(done)
 
-  REAL(rstd),SAVE :: p0,teta0,ttp,delt_y,delt_z,eps
+  REAL(rstd) :: p0,teta0,ttp,delt_y,delt_z,eps
 !$OMP THREADPRIVATE(p0,teta0,ttp,delt_y,delt_z,eps)
 
-  REAL(rstd),SAVE :: knewt_g, k_f,k_c_a,k_c_s
+  REAL(rstd) :: knewt_g, k_f,k_c_a,k_c_s
 !$OMP THREADPRIVATE(knewt_g, k_f,k_c_a,k_c_s)
 
@@ -31,7 +31,4 @@
     TYPE(t_field),POINTER :: f_q(:)
     TYPE(t_field),POINTER :: f_Ki(:)
-
-    REAL(rstd),POINTER :: Ki(:,:)
-    INTEGER :: ind
 
     CALL allocate_field(f_ps,field_t,type_real)
@@ -104,5 +101,4 @@
   SUBROUTINE init_Teq
     USE disvert_mod, ONLY : ap,bp
-    REAL(rstd),POINTER :: clat(:) 
     REAL(rstd),POINTER :: theta_eq(:,:) 
     REAL(rstd) :: zsig
@@ -165,5 +161,5 @@
     REAL(rstd),INTENT(OUT) :: theta_eq(iim*jjm,llm) 
 
-    REAL(rstd) :: r, zsig, ddsin, tetastrat, tetajl
+    REAL(rstd) :: zsig, ddsin, tetastrat, tetajl
     INTEGER :: i,j,l,ij
 
@@ -213,5 +209,4 @@
     REAL(rstd),POINTER :: theta_eq(:,:)
     REAL(rstd),POINTER :: theta(:,:)
-    REAL(rstd),POINTER :: clat(:)
     INTEGER::ind
 
Index: /codes/icosagcm/trunk/src/initial/etat0_venus.f90
===================================================================
--- /codes/icosagcm/trunk/src/initial/etat0_venus.f90	(revision 898)
+++ /codes/icosagcm/trunk/src/initial/etat0_venus.f90	(revision 899)
@@ -102,7 +102,5 @@
     REAL(rstd),POINTER :: phis(:)
     REAL(rstd),POINTER :: u(:,:)
-    REAL(rstd),POINTER :: q(:,:,:)
-    REAL(rstd) :: lat(iim*jjm)        ! latitude                    
-    REAL(rstd) :: pplay(iim*jjm, llm) ! pressure at full layers
+    REAL(rstd),POINTER :: q(:,:,:)                  
     INTEGER :: ind
 
@@ -143,5 +141,4 @@
     
     real(rstd) ::  lon,lat, pplay, ztemp,zdt,fact
-    logical, save ::  firstcall
     integer :: i,j,ij, l,ll
     
Index: /codes/icosagcm/trunk/src/kernels/compute_NH_geopot.k90
===================================================================
--- /codes/icosagcm/trunk/src/kernels/compute_NH_geopot.k90	(revision 898)
+++ /codes/icosagcm/trunk/src/kernels/compute_NH_geopot.k90	(revision 899)
@@ -107,8 +107,8 @@
          PRINT *, '[hevi_solver] C,D', iter, MAXVAL(ABS(C_ik)),MAXVAL(ABS(D_il))
          DO l=1,llm+1
-            WRITE(*,'(A,I2.1,I3.2,E9.2)'), '[hevi_solver] x_il', iter,l, MAXVAL(ABS(x_il(l,:)))
+            WRITE(*,'(A,I2.1,I3.2,E9.2)') '[hevi_solver] x_il', iter,l, MAXVAL(ABS(x_il(l,:)))
          END DO
          DO l=1,llm+1
-            WRITE(*,'(A,I2.1,I3.2,E9.2)'), '[hevi_solver] R_il', iter,l, MAXVAL(ABS(R_il(l,:)))
+            WRITE(*,'(A,I2.1,I3.2,E9.2)') '[hevi_solver] R_il', iter,l, MAXVAL(ABS(R_il(l,:)))
          END DO
       END IF
Index: /codes/icosagcm/trunk/src/output/netcdf_mod.F90
===================================================================
--- /codes/icosagcm/trunk/src/output/netcdf_mod.F90	(revision 898)
+++ /codes/icosagcm/trunk/src/output/netcdf_mod.F90	(revision 899)
@@ -81,4 +81,5 @@
         integer,                         intent(out) :: varid
         integer                                      :: nf90_def_var
+        nf90_def_var = 0
     end function nf90_def_var
     
@@ -89,4 +90,5 @@
         integer, dimension(:), optional, intent( in) :: start, count, stride, map
         integer                                      :: nf90_put_var_int0
+        nf90_put_var_int0 = 0
     end function nf90_put_var_int0
 
@@ -96,4 +98,5 @@
         integer, dimension(:), optional, intent( in) :: start, count, stride, map
         integer                                      :: nf90_put_var_int1
+        nf90_put_var_int1 = 0
     end function nf90_put_var_int1
 
@@ -103,4 +106,5 @@
         integer, dimension(:), optional, intent( in) :: start, count, stride, map
         integer                                      :: nf90_put_var_int2
+        nf90_put_var_int2 = 0
     end function nf90_put_var_int2
 
@@ -110,4 +114,5 @@
         integer, dimension(:), optional, intent( in) :: start, count, stride, map
         integer                                      :: nf90_put_var_int3
+        nf90_put_var_int3 = 0
     end function nf90_put_var_int3
     
@@ -116,5 +121,6 @@
         real,                              intent( in) :: values
         integer, dimension(:), optional, intent( in) :: start, count, stride, map
-        integer                                      :: nf90_put_var_real0   
+        integer                                      :: nf90_put_var_real0
+        nf90_put_var_real0 = 0
    end function nf90_put_var_real0
 
@@ -123,5 +129,6 @@
         real,                              intent( in) :: values(:)
         integer, dimension(:), optional, intent( in) :: start, count, stride, map
-        integer                                      :: nf90_put_var_real1   
+        integer                                      :: nf90_put_var_real1
+        nf90_put_var_real1 = 0
    end function nf90_put_var_real1
 
@@ -130,5 +137,6 @@
         real,                              intent( in) :: values(:,:)
         integer, dimension(:), optional, intent( in) :: start, count, stride, map
-        integer                                      :: nf90_put_var_real2   
+        integer                                      :: nf90_put_var_real2
+        nf90_put_var_real2 = 0
    end function nf90_put_var_real2
 
@@ -137,5 +145,6 @@
         real,                              intent( in) :: values(:,:,:)
         integer, dimension(:), optional, intent( in) :: start, count, stride, map
-        integer                                      :: nf90_put_var_real3   
+        integer                                      :: nf90_put_var_real3
+        nf90_put_var_real3 = 0
    end function nf90_put_var_real3
  
@@ -146,4 +155,5 @@
         integer, dimension(:), optional, intent( in) :: start, count, stride, map
         integer                                      :: nf90_get_var_int0
+        nf90_get_var_int0 = 0
     end function nf90_get_var_int0
 
@@ -153,4 +163,5 @@
         integer, dimension(:), optional, intent( in) :: start, count, stride, map
         integer                                      :: nf90_get_var_int1
+        nf90_get_var_int1 = 0
     end function nf90_get_var_int1
 
@@ -160,4 +171,5 @@
         integer, dimension(:), optional, intent( in) :: start, count, stride, map
         integer                                      :: nf90_get_var_int2
+        nf90_get_var_int2 = 0
     end function nf90_get_var_int2
 
@@ -167,4 +179,5 @@
         integer, dimension(:), optional, intent( in) :: start, count, stride, map
         integer                                      :: nf90_get_var_int3
+        nf90_get_var_int3 = 0
     end function nf90_get_var_int3
     
@@ -173,5 +186,6 @@
         real,                              intent( out) :: values
         integer, dimension(:), optional, intent( in) :: start, count, stride, map
-        integer                                      :: nf90_get_var_real0   
+        integer                                      :: nf90_get_var_real0
+        nf90_get_var_real0 = 0
    end function nf90_get_var_real0
 
@@ -180,5 +194,6 @@
         real,                              intent( out) :: values(:)
         integer, dimension(:), optional, intent( in) :: start, count, stride, map
-        integer                                      :: nf90_get_var_real1   
+        integer                                      :: nf90_get_var_real1
+        nf90_get_var_real1 = 0
    end function nf90_get_var_real1
 
@@ -187,5 +202,6 @@
         real,                              intent( out) :: values(:,:)
         integer, dimension(:), optional, intent( in) :: start, count, stride, map
-        integer                                      :: nf90_get_var_real2   
+        integer                                      :: nf90_get_var_real2
+        nf90_get_var_real2 = 0
    end function nf90_get_var_real2
 
@@ -194,5 +210,6 @@
         real,                              intent( out) :: values(:,:,:)
         integer, dimension(:), optional, intent( in) :: start, count, stride, map
-        integer                                      :: nf90_get_var_real3   
+        integer                                      :: nf90_get_var_real3
+        nf90_get_var_real3 = 0
    end function nf90_get_var_real3
   
Index: /codes/icosagcm/trunk/src/output/output_field.f90
===================================================================
--- /codes/icosagcm/trunk/src/output/output_field.f90	(revision 898)
+++ /codes/icosagcm/trunk/src/output/output_field.f90	(revision 899)
@@ -7,7 +7,7 @@
   PRIVATE
 
-  LOGICAL,SAVE :: xios_output 
+  LOGICAL :: xios_output 
 !$OMP THREADPRIVATE(xios_output)     
-  LOGICAL,SAVE :: enable_io    
+  LOGICAL :: enable_io    
 !$OMP THREADPRIVATE(enable_io)     
 
Index: /codes/icosagcm/trunk/src/output/restart.f90
===================================================================
--- /codes/icosagcm/trunk/src/output/restart.f90	(revision 898)
+++ /codes/icosagcm/trunk/src/output/restart.f90	(revision 899)
@@ -60,5 +60,4 @@
    
   TYPE(t_domain),POINTER :: d
-  TYPE(t_field),POINTER :: field_glo(:)
   TYPE(t_field),POINTER :: field(:)
   
@@ -421,14 +420,11 @@
   INTEGER             :: fieldId(20)
    
-  TYPE(t_domain),POINTER :: d
-  TYPE(t_field),POINTER :: field_glo(:)
   TYPE(t_field),POINTER :: field(:)
   
   CHARACTER(LEN=255) :: start_file_name
   INTEGER,PARAMETER  :: nvert=6
-  INTEGER    ::  ncid, cellId, levId, edgeId,  vertid, lonId, latId, bounds_lonId, bounds_latId
-  INTEGER    :: ind,ind_glo,i,j,k,nf
+  INTEGER    ::  ncid
+  INTEGER    :: nf
   INTEGER    :: status
-  REAL(rstd),ALLOCATABLE :: lon(:),lat(:),bounds_lon(:,:),bounds_lat(:,:)
   REAL(rstd) :: it_real
   
@@ -464,5 +460,5 @@
 !      CALL xios_recv_field("it_start",it_real)
       CALL xios_read_var("it_start",it_real)
-      it=it_real
+      it=INT(it_real)
     ELSE
 
Index: /codes/icosagcm/trunk/src/output/write_field.f90
===================================================================
--- /codes/icosagcm/trunk/src/output/write_field.f90	(revision 898)
+++ /codes/icosagcm/trunk/src/output/write_field.f90	(revision 899)
@@ -350,13 +350,10 @@
       REAL(r8),ALLOCATABLE :: field_val2d(:)
       REAL(r8),ALLOCATABLE :: field_val3d(:,:)
-      REAL(r8),ALLOCATABLE :: field_val4d(:,:,:)
       LOGICAL, INTENT(IN) :: once
       TYPE(t_domain),POINTER :: d
       INTEGER :: Index
       INTEGER :: ind,i,j,k,n,ncell,q
-      INTEGER :: iie,jje,iin,jjn
       INTEGER :: status
       CHARACTER(len=255) :: name
-      CHARACTER(len=255) :: str_ind
       INTEGER :: ind_b,ind_e
       INTEGER :: halo_size
@@ -394,5 +391,5 @@
 	Index=GetFieldIndex(name)
       else
-        FieldIndex(Index)=FieldIndex(Index)+1.
+        FieldIndex(Index)=FieldIndex(Index)+1
       endif
       
@@ -629,12 +626,9 @@
       REAL(r8),ALLOCATABLE :: field_val2d(:)
       REAL(r8),ALLOCATABLE :: field_val3d(:,:)
-      REAL(r8),ALLOCATABLE :: field_val4d(:,:,:)
       TYPE(t_domain),POINTER :: d
       INTEGER :: Index
       INTEGER :: ind,i,j,l,k,n,ncell,q
-      INTEGER :: iie,jje,iin,jjn
       INTEGER :: status
       CHARACTER(len=255) :: name
-      CHARACTER(len=255) :: str_ind
       INTEGER :: ind_b,ind_e
       INTEGER :: halo_size
@@ -664,5 +658,5 @@
 	Index=GetFieldIndex(name)
       else
-        FieldIndex(Index)=FieldIndex(Index)+1.
+        FieldIndex(Index)=FieldIndex(Index)+1
       endif
       
@@ -1165,8 +1159,7 @@
       TYPE(t_domain),POINTER :: d
       INTEGER :: nvertId,ncid,lonId,latId,bounds_lonId,bounds_latId,timeId,ncellId
-      INTEGER :: dim3id,dim4id
+      INTEGER :: dim3id
       INTEGER :: status
       INTEGER :: ind,i,j,k,n,q
-      INTEGER :: iie,jje,iin,jjn
       INTEGER :: ind_b,ind_e
       INTEGER :: halo_size
@@ -1174,5 +1167,5 @@
       INTEGER :: nij
       CHARACTER(LEN=255) :: name
-      INTEGER :: l,level_size, levId, dimlevId
+      INTEGER :: l,level_size, levId
             
       name=TRIM(ADJUSTL(name_in))
@@ -1477,8 +1470,7 @@
       TYPE(t_domain),POINTER :: d
       INTEGER :: nvertId,ncid,lonId,latId,bounds_lonId,bounds_latId,timeId,ncellId
-      INTEGER :: dim3id,dim4id
+      INTEGER :: dim3id
       INTEGER :: status
       INTEGER :: ind,i,j,k,n,q
-      INTEGER :: iie,jje,iin,jjn
       INTEGER :: ind_b,ind_e
       INTEGER :: halo_size
@@ -1783,5 +1775,5 @@
    USE netcdf_mod
    IMPLICIT NONE
-     INTEGER :: i,k,status
+     INTEGER :: i,status
 !$OMP MASTER     
      DO i=1,NbField
@@ -1805,5 +1797,5 @@
     int2str=''
     do while (flag)
-      int2str=CHAR(MOD(i,10)+48)//int2str
+      int2str=CHAR(MOD(i,10)+48)//trim(int2str)
       i=i/10
       if (i==0) flag=.false.
Index: /codes/icosagcm/trunk/src/output/xios_mod.F90
===================================================================
--- /codes/icosagcm/trunk/src/output/xios_mod.F90	(revision 898)
+++ /codes/icosagcm/trunk/src/output/xios_mod.F90	(revision 899)
@@ -9,4 +9,6 @@
   LOGICAL,SAVE :: using_xios
 
+#ifdef CPP_USING_XIOS
+  
   INTEGER,SAVE :: ncell_i
 !$OMP THREADPRIVATE(ncell_i)
@@ -17,6 +19,4 @@
 
   PRIVATE ncell_i,ncell_v,ncell_e
-
-#ifdef CPP_USING_XIOS
   
 CONTAINS
Index: /codes/icosagcm/trunk/src/parallel/domain.f90
===================================================================
--- /codes/icosagcm/trunk/src/parallel/domain.f90	(revision 898)
+++ /codes/icosagcm/trunk/src/parallel/domain.f90	(revision 899)
@@ -83,5 +83,5 @@
   USE ioipsl
   IMPLICIT NONE
-  INTEGER :: ind,nf,ni,nj,i,j
+  INTEGER :: ind,nf,ni,nj
   INTEGER :: quotient, rest
   INTEGER :: halo_i,halo_j
@@ -176,5 +176,4 @@
   SUBROUTINE copy_domain(d1,d2)
   IMPLICIT NONE
-  INTEGER :: face
   TYPE(t_domain),TARGET,INTENT(IN) :: d1
   TYPE(t_domain), INTENT(OUT) :: d2
@@ -543,5 +542,5 @@
     
     
-    block_j=sqrt(nsplit_i*nsplit_j*nb_face*1./mpi_size)
+    block_j=INT(sqrt(nsplit_i*nsplit_j*nb_face*1./mpi_size))
     exit=.FALSE.
     jb=1
@@ -625,5 +624,5 @@
           DO i=1,nsplit_i
             ind_glo=ind_glo+1
-            WRITE(*,"(' ',i4.4  ,' |')",ADVANCE='NO'),domglo_rank(ind_glo)           
+            WRITE(*,"(' ',i4.4  ,' |')",ADVANCE='NO') domglo_rank(ind_glo)           
           END DO
           PRINT *,''
Index: /codes/icosagcm/trunk/src/parallel/transfert_mpi.f90
===================================================================
--- /codes/icosagcm/trunk/src/parallel/transfert_mpi.f90	(revision 898)
+++ /codes/icosagcm/trunk/src/parallel/transfert_mpi.f90	(revision 899)
@@ -100,5 +100,4 @@
   IMPLICIT NONE
   INTEGER :: ind,i,j
-  LOGICAL ::ok
 
     CALL register_id('MPI', id_mpi)
@@ -484,5 +483,5 @@
 
     INTEGER :: rank,i,j,pos
-    INTEGER :: size_,ind_glo,ind_loc, ind_src
+    INTEGER :: size_,ind_glo,ind_loc
     INTEGER :: isend, irecv, ireq, nreq, nsend, nrecv
     INTEGER, ALLOCATABLE :: mpi_req(:)
@@ -932,11 +931,9 @@
     CHARACTER(LEN=*), INTENT(IN),OPTIONAL :: name
 
-    TYPE(ARRAY),POINTER :: recv,send 
     TYPE(t_request),POINTER :: req
     INTEGER :: irecv,isend
-    INTEGER :: ireq,nreq, nreq_send
+    INTEGER :: ireq,nreq
     INTEGER :: ind
     INTEGER :: dim3,dim4
-    INTEGER :: i,j
     INTEGER,SAVE :: message_number=0
 !    TYPE(t_reorder),POINTER :: reorder(:)
@@ -1061,8 +1058,5 @@
     TYPE(t_message) :: message
 
-    TYPE(t_request),POINTER :: req
-    INTEGER :: irecv,isend
-    INTEGER :: ireq,nreq
-    INTEGER :: ind
+    INTEGER :: ireq
 
 !$OMP BARRIER
@@ -1145,12 +1139,9 @@
     TYPE(ARRAY),POINTER :: recv,send 
     TYPE(t_request),POINTER :: req
-    INTEGER, ALLOCATABLE :: mpi_req(:)
-    INTEGER, ALLOCATABLE :: status(:,:)
     INTEGER :: irecv,isend
-    INTEGER :: ireq,nreq
-    INTEGER :: ind,i,n,l,m
+    INTEGER :: ireq
+    INTEGER :: ind,n
     INTEGER :: dim3,dim4,d3,d4
     INTEGER,POINTER :: src_value(:)
-    INTEGER,POINTER :: sign(:)
     INTEGER :: offset,msize,rank
     INTEGER :: lbegin, lend
@@ -1554,11 +1545,9 @@
     INTEGER,POINTER :: value(:) 
     INTEGER,POINTER :: sgn(:) 
-    TYPE(ARRAY),POINTER :: recv,send 
+    TYPE(ARRAY),POINTER :: recv 
     TYPE(t_request),POINTER :: req
-    INTEGER, ALLOCATABLE :: mpi_req(:)
-    INTEGER, ALLOCATABLE :: status(:,:)
-    INTEGER :: irecv,isend
+    INTEGER :: irecv
     INTEGER :: ireq,nreq
-    INTEGER :: ind,n,l,m,i
+    INTEGER :: ind,n
     INTEGER :: dim3,dim4,d3,d4,lbegin,lend
     INTEGER :: offset
@@ -1741,5 +1730,4 @@
     TYPE(t_request),POINTER :: req
     INTEGER :: n
-    REAL(rstd) :: var1,var2
     
     DO ind=1,ndomain
Index: /codes/icosagcm/trunk/src/physics/physics.f90
===================================================================
--- /codes/icosagcm/trunk/src/physics/physics.f90	(revision 898)
+++ /codes/icosagcm/trunk/src/physics/physics.f90	(revision 899)
@@ -11,5 +11,4 @@
 
   INTEGER :: phys_type
-  TYPE(t_field),POINTER,SAVE :: f_extra_physics_2D(:), f_extra_physics_3D(:)
   TYPE(t_field),POINTER,SAVE :: f_dulon(:), f_dulat(:)
   TYPE(t_field),POINTER,SAVE :: f_ulon(:), f_ulat(:)
@@ -162,12 +161,7 @@
     TYPE(t_field),POINTER :: f_wflux(:)
     TYPE(t_field),POINTER :: f_q(:)
-    
+
     LOGICAL,SAVE :: first=.TRUE.
-!$OMP THREADPRIVATE(first)
-    
-    LOGICAL:: firstcall,lastcall
-    INTEGER :: ind
-    TYPE(t_physics_inout) :: args
-
+    !$OMP THREADPRIVATE(first)
     IF (first) THEN
       CALL init_message(f_theta_rhodz, req_i0, req_theta0)
@@ -176,6 +170,5 @@
       first=.FALSE.
     ENDIF
-
-
+    
     IF (phys_external) THEN
     
Index: /codes/icosagcm/trunk/src/physics/physics_interface.f90
===================================================================
--- /codes/icosagcm/trunk/src/physics/physics_interface.f90	(revision 898)
+++ /codes/icosagcm/trunk/src/physics/physics_interface.f90	(revision 899)
@@ -195,5 +195,5 @@
     USE icosa
     IMPLICIT NONE
-    INTEGER :: ind, offset
+    INTEGER :: ind
     DO ind=1,ndomain
        IF (.NOT. assigned_domain(ind)) CYCLE
Index: /codes/icosagcm/trunk/src/sphere/geometry.f90
===================================================================
--- /codes/icosagcm/trunk/src/sphere/geometry.f90	(revision 898)
+++ /codes/icosagcm/trunk/src/sphere/geometry.f90	(revision 899)
@@ -185,6 +185,4 @@
     IMPLICIT NONE
     REAL(rstd) :: x1(3),x2(3)
-    REAL(rstd) :: vect(3,6)
-    REAL(rstd) :: centr(3)
     INTEGER :: ind,i,j,n,k
     TYPE(t_message),SAVE :: message0, message1
@@ -433,5 +431,5 @@
     REAL(rstd) :: vect(3,6)
     REAL(rstd) :: centr(3)
-    REAL(rstd) :: vet(3),vep(3), vertex(3)
+    REAL(rstd) :: vet(3),vep(3)
     INTEGER :: ind,i,j,k,n
     TYPE(t_domain),POINTER :: d
@@ -440,5 +438,4 @@
     REAL(rstd) :: lon,lat
     INTEGER :: ii_glo,jj_glo
-    REAL(rstd) :: S
           
       
Index: /codes/icosagcm/trunk/src/sphere/metric.f90
===================================================================
--- /codes/icosagcm/trunk/src/sphere/metric.f90	(revision 898)
+++ /codes/icosagcm/trunk/src/sphere/metric.f90	(revision 899)
@@ -117,5 +117,5 @@
     REAL(rstd) :: rot=0.
     INTEGER :: nf,i,j
-    REAL(rstd),DIMENSION(3) :: p1,p2,p3
+    REAL(rstd),DIMENSION(3) :: p1
     REAL(rstd) :: d1,d2,d3
   
@@ -180,6 +180,4 @@
     REAL(rstd) :: rot=0.
     INTEGER :: nf,i,j
-    REAL(rstd),DIMENSION(3) :: p1,p2,p3
-    REAL(rstd) :: d1,d2,d3
   
    len_edge=acos(cos(Pi/5)*cos(2*Pi/5)/(sin(Pi/5)*sin(2*Pi/5)))
@@ -467,6 +465,5 @@
     INTEGER :: ind,ind2
     INTEGER :: nf,nf2,nfm1,nfp1
-    INTEGER :: i,j,k
-    INTEGER :: delta
+    INTEGER :: i,j
     
     ind=0
@@ -836,5 +833,5 @@
   SUBROUTINE set_cell_vertex
   IMPLICIT NONE
-    INTEGER :: i,j,k,k2
+    INTEGER :: k,k2
     INTEGER :: ind,ind1,ind2
     INTEGER :: ng1,ng2
Index: /codes/icosagcm/trunk/src/sphere/spherical_geom.f90
===================================================================
--- /codes/icosagcm/trunk/src/sphere/spherical_geom.f90	(revision 898)
+++ /codes/icosagcm/trunk/src/sphere/spherical_geom.f90	(revision 899)
@@ -28,5 +28,4 @@
   REAL(rstd),INTENT(OUT) :: lat
   
-  REAL(rstd) :: coslat
   REAL(rstd) :: xyzn(3)
   
@@ -136,14 +135,7 @@
   REAL(rstd) :: d
   REAL(rstd) :: M(3,3)
-  REAL(rstd) :: alpha(3,3)
-  INTEGER    :: IPIV(3)
-  INTEGER    :: info
   REAL(rstd) :: xa,xb,xc
   REAL(rstd) :: ya,yb,yc
   REAL(rstd) :: za,zb,zc
-  REAL(rstd) :: alpha_A,alpha_B,alpha_C
-  REAL(rstd) :: x,y,z
-  REAL(rstd) :: a1,a2,a3
-  REAL(rstd) :: b1,b2,b3
   
   
Index: /codes/icosagcm/trunk/src/sphere/vector.f90
===================================================================
--- /codes/icosagcm/trunk/src/sphere/vector.f90	(revision 898)
+++ /codes/icosagcm/trunk/src/sphere/vector.f90	(revision 899)
@@ -13,5 +13,5 @@
   END FUNCTION Norm
   
-  FUNCTION dot_product(V1,V2)
+  FUNCTION dot_product_3d(V1,V2) result(dot_product)
   IMPLICIT NONE
     REAL(rstd)       :: dot_product
@@ -21,5 +21,5 @@
     dot_product=V1(1)*V2(1)+V1(2)*V2(2)+V1(3)*V2(3)
     
-   END FUNCTION dot_product
+   END FUNCTION dot_product_3d
    
    FUNCTION cross_product(Va,Vb)
Index: /codes/icosagcm/trunk/src/time/euler_scheme.f90
===================================================================
--- /codes/icosagcm/trunk/src/time/euler_scheme.f90	(revision 898)
+++ /codes/icosagcm/trunk/src/time/euler_scheme.f90	(revision 899)
@@ -36,5 +36,5 @@
     REAL(rstd),POINTER :: hflux(:,:),wflux(:,:),hfluxt(:,:),wfluxt(:,:)
     INTEGER :: ind
-    INTEGER :: i,j,ij,l
+    INTEGER :: ij,l
     CALL trace_start("Euler_scheme")  
 
@@ -95,5 +95,5 @@
     REAL(rstd), INTENT(IN) :: tau
     LOGICAL, INTENT(INOUT) :: fluxt_zero
-    INTEGER :: l,i,j,ij
+    INTEGER :: l,ij
 
     IF(fluxt_zero) THEN
Index: /codes/icosagcm/trunk/src/time/explicit_scheme.f90
===================================================================
--- /codes/icosagcm/trunk/src/time/explicit_scheme.f90	(revision 898)
+++ /codes/icosagcm/trunk/src/time/explicit_scheme.f90	(revision 899)
@@ -22,8 +22,7 @@
 !    USE caldyn_gcm_mod, ONLY : req_ps, req_mass
 
-    REAL(rstd),POINTER :: q(:,:,:)
-    REAL(rstd),POINTER :: phis(:), ps(:) ,psm1(:), psm2(:), dps(:)
+    REAL(rstd),POINTER :: ps(:) ,psm1(:), psm2(:), dps(:)
     REAL(rstd),POINTER :: u(:,:) , um1(:,:), um2(:,:), du(:,:)
-    REAL(rstd),POINTER :: rhodz(:,:), mass(:,:), massm1(:,:), massm2(:,:), dmass(:,:)
+    REAL(rstd),POINTER :: mass(:,:), massm1(:,:), dmass(:,:)
     REAL(rstd),POINTER :: theta_rhodz(:,:,:) , theta_rhodzm1(:,:,:), theta_rhodzm2(:,:,:), dtheta_rhodz(:,:,:)
     REAL(rstd),POINTER :: hflux(:,:),wflux(:,:),hfluxt(:,:),wfluxt(:,:)
@@ -64,5 +63,5 @@
       REAL(rstd), INTENT(IN) :: coef(:)
       REAL(rstd) :: tau
-      INTEGER :: i,j,ij,l
+      INTEGER :: ij,l
 
       CALL trace_start("RK_scheme")  
Index: /codes/icosagcm/trunk/src/time/time.f90
===================================================================
--- /codes/icosagcm/trunk/src/time/time.f90	(revision 898)
+++ /codes/icosagcm/trunk/src/time/time.f90	(revision 899)
@@ -54,5 +54,5 @@
     run_length=dt*itaumax
     CALL getin('run_length',run_length)
-    itaumax=run_length/dt
+    itaumax=INT(run_length/dt)
     
     time_style='dcmip'
Index: /codes/icosagcm/trunk/src/time/timeloop_gcm.f90
===================================================================
--- /codes/icosagcm/trunk/src/time/timeloop_gcm.f90	(revision 898)
+++ /codes/icosagcm/trunk/src/time/timeloop_gcm.f90	(revision 899)
@@ -194,5 +194,5 @@
 
     REAL(rstd) :: adv_over_out ! ratio itau_adv/itau_out
-    INTEGER :: ind, it,i,j,l,n,  stage
+    INTEGER :: ind, it,l
     LOGICAL :: fluxt_zero(ndomain) ! set to .TRUE. to start accumulating mass fluxes in time
     LOGICAL, PARAMETER :: check_rhodz=.FALSE.
@@ -401,5 +401,5 @@
        elapsed = (stop_clock-start_clock)*1./rate_clock
        per_step = elapsed/(it-itau0)
-       throughput = dt/per_step
+       throughput = INT(dt/per_step)
        total = per_step*itaumax
        WRITE(*,'(A,I5,A,F6.2,A,I6)') 'Time spent (s):',INT(elapsed), &
Index: /codes/icosagcm/trunk/src/transport/advect.F90
===================================================================
--- /codes/icosagcm/trunk/src/transport/advect.F90	(revision 898)
+++ /codes/icosagcm/trunk/src/transport/advect.F90	(revision 899)
@@ -59,10 +59,9 @@
     REAL(rstd),INTENT(OUT) :: gradq3d(iim*jjm,llm,3)
     REAL(rstd) :: maxq,minq,minq_c,maxq_c 
-    REAL(rstd) :: alphamx,alphami,alpha	,maggrd
-    REAL(rstd) :: leng1,leng2
+    REAL(rstd) :: alphamx,alphami,alpha,maggrd
     REAL(rstd) :: arr(2*iim*jjm)
     REAL(rstd) :: ar(iim*jjm)
     REAL(rstd) :: gradtri(2*iim*jjm,llm,3) 
-    INTEGER :: ij,k,ind,l
+    INTEGER :: ij,k,l
     REAL(rstd) :: detx,dety,detz,det
     REAL(rstd) :: A(3,3), a11,a12,a13,a21,a22,a23,a31,a32,a33
@@ -243,5 +242,5 @@
 !DIR$ SIMD
       DO ij=ij_begin,ij_end
-!             maggrd =  dot_product(gradq3d(ij,l,:),gradq3d(ij,l,:))
+!             maggrd =  dot_product_3d(gradq3d(ij,l,:),gradq3d(ij,l,:))
              maggrd = gradq3d(ij,l,1)*gradq3d(ij,l,1) + gradq3d(ij,l,2)*gradq3d(ij,l,2) + gradq3d(ij,l,3)*gradq3d(ij,l,3) 
              maggrd = sqrt(maggrd) 
@@ -275,11 +274,6 @@
     REAL(rstd), INTENT(OUT)    :: dq1,dq2,dq3,det
     REAL(rstd)    :: dq(3)
-    
-    REAL(rstd)  ::detx,dety,detz
-    INTEGER    :: info
-    INTEGER    :: IPIV(3)
 
     REAL(rstd) :: A(3,3)
-    REAL(rstd) :: B(3)
     
     ! TODO : replace A by A1,A2,A3
@@ -345,5 +339,5 @@
     REAL(rstd),INTENT(IN)    :: tau
 
-    REAL(rstd) :: v_e(3), up_e, qe, ed(3)    
+    REAL(rstd) :: v_e(3), up_e   
     INTEGER :: ij,l
 
@@ -422,7 +416,7 @@
     REAL(rstd), INTENT(INOUT) :: qfluxt(3*iim*jjm,MERGE(llm,1,diagflux_on)) ! time-integrated tracer flux
 
-    REAL(rstd) :: dq,dmass,qe,ed(3), newmass
+    REAL(rstd) :: dq,dmass,qe, newmass
     REAL(rstd) :: qflux(3*iim*jjm,llm)
-    INTEGER :: ij,k,l
+    INTEGER :: ij,l
 
     CALL trace_start("compute_advect_horiz")
Index: /codes/icosagcm/trunk/src/transport/advect_tracer.f90
===================================================================
--- /codes/icosagcm/trunk/src/transport/advect_tracer.f90	(revision 898)
+++ /codes/icosagcm/trunk/src/transport/advect_tracer.f90	(revision 899)
@@ -242,5 +242,5 @@
 
     REAL(rstd) :: dzqmax, newmass, sigw, qq, w
-    INTEGER :: i,ij,l,j,ijb,ije
+    INTEGER :: ij,l,ijb,ije
 
     CALL trace_start("vlz")
Index: /codes/icosagcm/trunk/src/vertical/disvert_strato.f90
===================================================================
--- /codes/icosagcm/trunk/src/vertical/disvert_strato.f90	(revision 898)
+++ /codes/icosagcm/trunk/src/vertical/disvert_strato.f90	(revision 899)
@@ -75,5 +75,5 @@
   SUBROUTINE init_disvert_strato_custom
     REAL(rstd) :: vert_scale,vert_dzmin,vert_dzlow,vert_z0low,vert_dzmid,vert_z0mid,vert_h_mid,vert_dzhig,vert_z0hig,vert_h_hig
-    REAL(rstd) :: z, snorm, dsig(llm), sig(llm+1), sig0(llm+1), zz(llm+1)
+    REAL(rstd) :: z, sig(llm+1), sig0(llm+1), zz(llm+1)
     INTEGER :: l
     ALLOCATE(ap(llm+1))
@@ -181,5 +181,5 @@
       ! Local variables:
       INTEGER      :: it, ns, maxit
-      REAL(rstd)   :: c1, c2, x1, x2, x3, x4, f1, f2, f3, f4, s, xx, distrib
+      REAL(rstd)   :: c1, c2, f1
       !-------------------------------------------------------------------------------
       ns=SIZE(sig); maxit=100
Index: /codes/icosagcm/trunk/tools/ioipsl/calendar.f90
===================================================================
--- /codes/icosagcm/trunk/tools/ioipsl/calendar.f90	(revision 898)
+++ /codes/icosagcm/trunk/tools/ioipsl/calendar.f90	(revision 899)
@@ -363,5 +363,5 @@
         ss = INT(dd)*one_day+dd-INT(dd)
         itau = itau+NINT(ss/dt)
-        tmp_str = tmp_str(y_pos+1:LEN_TRIM(tmp_str))
+        tmp_str = trim(tmp_str(y_pos+1:))
       ELSE IF (m_pos > 0) THEN
         WRITE(fmt,'("(I",I10.10,")")') m_pos-1
@@ -371,10 +371,10 @@
         ss = INT(dd)*one_day+dd-INT(dd)
         itau = itau+NINT(ss/dt)
-        tmp_str = tmp_str(m_pos+1:LEN_TRIM(tmp_str))
+        tmp_str = trim(tmp_str(m_pos+1:))
       ELSE IF (d_pos > 0) THEN
         WRITE(fmt,'("(I",I10.10,")")') d_pos-1
         READ(tmp_str(1:d_pos-1),fmt) read_time
         itau = itau+NINT(read_time*one_day/dt)
-        tmp_str = tmp_str(d_pos+1:LEN_TRIM(tmp_str))
+        tmp_str = trim(tmp_str(d_pos+1:))
       ELSE IF (h_pos > 0) THEN
         WRITE(fmt,'("(I",I10.10,")")') h_pos-1
@@ -386,5 +386,5 @@
         READ(tmp_str(1:s_pos-1),fmt) read_time
         itau = itau+NINT(read_time/dt)
-        tmp_str = tmp_str(s_pos+1:LEN_TRIM(tmp_str))
+        tmp_str = trim(tmp_str(s_pos+1:))
       ENDIF
 !-
@@ -460,5 +460,5 @@
  &   ' Please call ioconf_startdate before itau2ymds.')
   ENDIF
-  julian_day = start_day
+  julian_day = INT(start_day)
   julian_sec = start_sec+REAL(itau)*deltat
   CALL ju2ymds_internal (julian_day,julian_sec,year,month,day,sec)
@@ -558,5 +558,5 @@
       date_last_act = itau2date (last_action,date0,dt)
       CALL ju2ymds (date_last_act,year,month,day,sec)
-      monthp1 = month-freq
+      monthp1 = INT(month-freq)
       yearp = year
 !-
@@ -575,5 +575,5 @@
 !---- then we will take it as it is better.
 !-
-      monthp1 = month+ABS(freq)
+      monthp1 = INT(month+ABS(freq))
       yearp=year
       IF (monthp1 >= 13) THEN
Index: /codes/icosagcm/trunk/tools/ioipsl/getincom.f90
===================================================================
--- /codes/icosagcm/trunk/tools/ioipsl/getincom.f90	(revision 898)
+++ /codes/icosagcm/trunk/tools/ioipsl/getincom.f90	(revision 899)
@@ -659,5 +659,5 @@
   INTEGER :: k_typ,nb_to_ret,it,pos,len_str,status_cnt,io_err
   CHARACTER(LEN=n_d_fmt)  :: cnt
-  CHARACTER(LEN=80) :: str_READ,str_READ_lower
+  CHARACTER(LEN=100) :: str_READ,str_READ_lower
   CHARACTER(LEN=9)  :: c_vtyp
   LOGICAL,DIMENSION(:),ALLOCATABLE :: found
@@ -1416,5 +1416,4 @@
 !-
   TYPE(t_key),ALLOCATABLE,DIMENSION(:) :: tmp_key_tab
-  CHARACTER(LEN=100),ALLOCATABLE :: tmp_str(:)
 !-
   INTEGER :: ier
