diff --git a/NonLinearSolver/materialLaw/mlawAnisotropicStoch.cpp b/NonLinearSolver/materialLaw/mlawAnisotropicStoch.cpp
index 7824e84b38366c66ba938e24d05e1888158f1f54..0d614963b3bc099eef119b240b6c294052abcf2f 100644
--- a/NonLinearSolver/materialLaw/mlawAnisotropicStoch.cpp
+++ b/NonLinearSolver/materialLaw/mlawAnisotropicStoch.cpp
@@ -24,7 +24,7 @@ mlawAnisotropicStoch::mlawAnisotropicStoch(const int num, const double rho, cons
 
    FILE *Props = fopen(propName, "r");
    if ( Props != NULL ){
-     fscanf(Props, "%d %d\n", &nxy[0], &nxy[1]);
+     int okf = fscanf(Props, "%d %d\n", &nxy[0], &nxy[1]);
 
      bool resizeFlag = _ExMat.resize(nxy[0], nxy[1], true);
      resizeFlag = _EyMat.resize(nxy[0], nxy[1], true);
@@ -36,12 +36,12 @@ mlawAnisotropicStoch::mlawAnisotropicStoch(const int num, const double rho, cons
      resizeFlag = _MUxyMat.resize(nxy[0], nxy[1], true);
      resizeFlag = _MUxzMat.resize(nxy[0], nxy[1], true);
      resizeFlag = _MUyzMat.resize(nxy[0], nxy[1], true);
-     fscanf(Props, "%lf %lf\n", &_dx, &_dy);
+     okf = fscanf(Props, "%lf %lf\n", &_dx, &_dy);
 
      if (resizeFlag){
        for(int i=0; i<nxy[0]; i++){
           for(int j=0;j<nxy[1];j++){
-             fscanf(Props, "%lf %lf %lf %lf %lf %lf %lf %lf %lf\n", &Anisoprop[0], &Anisoprop[1],&Anisoprop[2],
+             okf = fscanf(Props, "%lf %lf %lf %lf %lf %lf %lf %lf %lf\n", &Anisoprop[0], &Anisoprop[1],&Anisoprop[2],
                           &Anisoprop[3],&Anisoprop[4],&Anisoprop[5],&Anisoprop[6],&Anisoprop[7],&Anisoprop[8]);
 
              _ExMat.set(i, j, Anisoprop[0]);
diff --git a/NonLinearSolver/modelReduction/Clustering.cpp b/NonLinearSolver/modelReduction/Clustering.cpp
index b1aa0bb342eb149e5d6474fc82b600a7f0486568..7af74d48556f812b537cc81fd96f80d37c9a6976 100644
--- a/NonLinearSolver/modelReduction/Clustering.cpp
+++ b/NonLinearSolver/modelReduction/Clustering.cpp
@@ -75,6 +75,7 @@ int Clustering::getMaterialLawNumberIncluster(int cluster) const
   if (itF == _clusterMaterialMap.end())
   {
     Msg::Error("material law for cluster %d cannot be found",cluster);
+    return 0;
   }
   else
   {
@@ -806,6 +807,8 @@ const STensor3& Clustering::getEigenStrain(int cluster) const
   if (itF == _allEigenStrains.end())
   {
     Msg::Error("eigven strain for cluster %d is not found",cluster);
+    static STensor3 a;
+    return a;
   }
   else
   {
diff --git a/NonLinearSolver/modelReduction/modelReduction.cpp b/NonLinearSolver/modelReduction/modelReduction.cpp
index cc6d9fd61af3bd72edc6bd88487021cf0a543ce4..73bb6852f34938502e494b96796347a9e64dbc71 100644
--- a/NonLinearSolver/modelReduction/modelReduction.cpp
+++ b/NonLinearSolver/modelReduction/modelReduction.cpp
@@ -22,6 +22,7 @@ const materialLaw* ReductionTFA::getMaterialLaw(int cluster) const
   {
     return itMat->second;
   }
+  return NULL;
 }
 
 void ReductionTFA::initializeClusterMaterialMap(const std::map<int,materialLaw*> &maplaw)
diff --git a/NonLinearSolver/nlsolver/cutMeshByBox.cpp b/NonLinearSolver/nlsolver/cutMeshByBox.cpp
index a08024b757df85532ee880d800918c00fc87bfde..2554a880eab921559a57407e7e08a210a2f0d2d4 100644
--- a/NonLinearSolver/nlsolver/cutMeshByBox.cpp
+++ b/NonLinearSolver/nlsolver/cutMeshByBox.cpp
@@ -373,7 +373,7 @@ void cutMeshByBox::write_MSH2(std::string filename){
 	fprintf(fp, "%d\n", numnodes);
 	for (elementGroup::vertexContainer::const_iterator it = _gVolume->vbegin(); it!= _gVolume->vend(); it++){
 		MVertex* v = it->second;
-		fprintf(fp, "%d %f %f %f\n",v->getNum(),v->x(),v->y(),v->z());
+		int okf = fprintf(fp, "%ld %f %f %f\n",v->getNum(),v->x(),v->y(),v->z());
 	}
 	fprintf(fp, "$EndNodes\n");
  	fprintf(fp, "$Elements\n");
@@ -633,14 +633,14 @@ void cutMeshByLevelSet::write_MSH2(elementGroup* g,  const std::string filename)
 
 
 	fprintf(fp, "$Nodes\n");
-	fprintf(fp, "%d\n", g->vsize());
+	fprintf(fp, "%ld\n", g->vsize());
 	for (elementGroup::vertexContainer::const_iterator it = g->vbegin(); it!= g->vend(); it++){
 		MVertex* v = it->second;
-		fprintf(fp, "%d %f %f %f\n",v->getNum(),v->x(),v->y(),v->z());
+		fprintf(fp, "%ld %f %f %f\n",v->getNum(),v->x(),v->y(),v->z());
 	}
 	fprintf(fp, "$EndNodes\n");
  	fprintf(fp, "$Elements\n");
-	fprintf(fp, "%d\n", g->size());
+	fprintf(fp, "%ld\n", g->size());
 
 	
   for (elementGroup::elementContainer::const_iterator it = g->begin(); it!= g->end(); it++){
@@ -733,10 +733,10 @@ void cutMeshByLevelSet::cut(const std::string inputModel, const levelSet* gl, co
 
 
 	fprintf(fp, "$Nodes\n");
-	fprintf(fp, "%d\n", allActiveVertices.size());
+	fprintf(fp, "%ld\n", allActiveVertices.size());
 	for (std::set<MVertex*>::iterator it = allActiveVertices.begin(); it!= allActiveVertices.end(); it++){
 		MVertex* v = *it;
-		fprintf(fp, "%d %f %f %f\n",v->getNum(),v->x(),v->y(),v->z());
+		fprintf(fp, "%ld %f %f %f\n",v->getNum(),v->x(),v->y(),v->z());
 	}
   
 	fprintf(fp, "$EndNodes\n");
@@ -754,9 +754,9 @@ void cutMeshByLevelSet::cut(const std::string inputModel, const levelSet* gl, co
       if (abs(phys)> maxphys) maxphys = abs(phys);
       for (elementGroup::elementContainer::const_iterator ite = grCut.begin(); ite != grCut.end(); ite++){
         MElement* ele = ite->second;
-        fprintf(fp,"%d %d 2 %d %d",ele->getNum(),ele->getTypeForMSH(),phys,phys);
+        fprintf(fp,"%ld %d 2 %d %d",ele->getNum(),ele->getTypeForMSH(),phys,phys);
         for (int i=0; i< ele->getNumVertices(); i++){
-          fprintf(fp," %d", ele->getVertex(i)->getNum());
+          fprintf(fp," %ld", ele->getVertex(i)->getNum());
         }
         fprintf(fp,"\n");
       }
@@ -765,9 +765,9 @@ void cutMeshByLevelSet::cut(const std::string inputModel, const levelSet* gl, co
   
   for (std::set<MElement*>::iterator ite = intersectionElements.begin(); ite != intersectionElements.end(); ite++){
     MElement* ele = *ite;
-    fprintf(fp,"%d %d 2 %d %d",ele->getNum(),ele->getTypeForMSH(),maxphys+1,maxphys+1);
+    fprintf(fp,"%ld %d 2 %d %d",ele->getNum(),ele->getTypeForMSH(),maxphys+1,maxphys+1);
     for (int i=0; i< ele->getNumVertices(); i++){
-      fprintf(fp," %d", ele->getVertex(i)->getNum());
+      fprintf(fp," %ld", ele->getVertex(i)->getNum());
     }
     fprintf(fp,"\n");
   }
@@ -781,4 +781,4 @@ void cutMeshByLevelSet::cut(const std::string inputModel, const levelSet* gl, co
   std::string bFile = "boundary_"+inputModel;
   write_MSH2(&allBoundaryElements,bFile);
   
-};
\ No newline at end of file
+};
diff --git a/NonLinearSolver/nlsolver/meshModification.cpp b/NonLinearSolver/nlsolver/meshModification.cpp
index 6e4838f553dfa2f5dbe17f1b0fdec2e0922f17f4..12cb3bb4c21cc597a26f6f4856b7272b9d0a8a1b 100644
--- a/NonLinearSolver/nlsolver/meshModification.cpp
+++ b/NonLinearSolver/nlsolver/meshModification.cpp
@@ -125,10 +125,10 @@ void makePhysicalByBox::write_MSH2(const std::map<int, elementGroup>& gMap,  con
  	fprintf(fp, "$MeshFormat\n2.2 0 8\n$EndMeshFormat\n");
 
 	fprintf(fp, "$Nodes\n");
-	fprintf(fp, "%d\n", allVertices.size());
+	fprintf(fp, "%ld\n", allVertices.size());
 	for (std::set<MVertex*>::const_iterator it = allVertices.begin(); it!= allVertices.end(); it++){
 		MVertex* v = *it;
-		fprintf(fp, "%d %f %f %f\n",v->getNum(),v->x(),v->y(),v->z());
+		fprintf(fp, "%ld %f %f %f\n",v->getNum(),v->x(),v->y(),v->z());
 	}
 	fprintf(fp, "$EndNodes\n");
  	fprintf(fp, "$Elements\n");
@@ -136,7 +136,7 @@ void makePhysicalByBox::write_MSH2(const std::map<int, elementGroup>& gMap,  con
   for (std::map<int, elementGroup>::const_iterator itg = gMap.begin(); itg!= gMap.end(); itg++)
   {
     const elementGroup* g = &(itg->second);
-    Msg::Info("num of eelement in gr %d = %d",itg->first,g->size());
+    Msg::Info("num of eelement in gr %d = %ld",itg->first,g->size());
     for (elementGroup::elementContainer::const_iterator it = g->begin(); it!= g->end(); it++){
       MElement* ele = it->second;
       ele->writeMSH2(fp,2.2,0,0,itg->first+1,itg->first+1);
@@ -187,7 +187,7 @@ void makePhysicalByBox::run(const std::string inputMeshFile, const std::string o
     }
   }
   
-  Msg::Info("pass hare box size = %d",allBox.size());
+  Msg::Info("pass hare box size = %ld",allBox.size());
   
   // get all elemeents from model
   GModel pModel;
@@ -258,4 +258,4 @@ void makePhysicalByBox::run(const std::string inputMeshFile, const std::string o
   }
   
   write_MSH2(allG,outputMeshFile);
-};
\ No newline at end of file
+};
diff --git a/NonLinearSolver/periodicBC/pbcCreateConstraints.cpp b/NonLinearSolver/periodicBC/pbcCreateConstraints.cpp
index 31375d468547a162368386709f8bdc099e4977f8..aa21db5855da3622b807befdb286b87af707d04c 100644
--- a/NonLinearSolver/periodicBC/pbcCreateConstraints.cpp
+++ b/NonLinearSolver/periodicBC/pbcCreateConstraints.cpp
@@ -4205,6 +4205,8 @@ SPoint3 pbcConstraintElementGroup::getRootPoint(){
 		}
 		else{
 			Msg::Error("getRootPoint has not been implemented for %d D problems",_solver->getMicroBC()->getDim());
+			static SPoint3 pt(0.,0.,0.);
+			return pt;
 		}
 	}
 };
diff --git a/dgshell/src/shellLocalBasis.cpp b/dgshell/src/shellLocalBasis.cpp
index 3065252d1bf706faf81dcc4df9fc7b9c02fbb598..5c52994d011b6c017467d17b5484ad8ae3f03827 100644
--- a/dgshell/src/shellLocalBasis.cpp
+++ b/dgshell/src/shellLocalBasis.cpp
@@ -429,6 +429,7 @@ nonLinearShellLocalBasisBulk&  nonLinearShellLocalBasisBulk::operator=(const she
     _detJ[i]= src->_detJ[i];
     _detJ0[i]=src->_detJ0[i];
   }
+  return *this;
 }
 void nonLinearShellLocalBasisBulk::set(MElement *ele, const std::vector<TensorialTraits<double>::GradType> &Grads,
                                        const std::vector<TensorialTraits<double>::HessType> &Hess,