diff --git a/src/bias/MetaD.cpp b/src/bias/MetaD.cpp
index b9e92fa8153875356375ecac7d130a1533cab943..4444641661988dd8f3582d4ad32cda46890a372c 100644
--- a/src/bias/MetaD.cpp
+++ b/src/bias/MetaD.cpp
@@ -1391,13 +1391,12 @@ void MetaD::computeReweightingFactor(){
 
  // Recover the minimum values for the grid
  unsigned ncv=getNumberOfArguments();
- double grid_size=1.0; unsigned ntotgrid=1;
+ unsigned ntotgrid=1;
  std::vector<double> dmin( ncv ),dmax( ncv ), grid_spacing( ncv ), vals( ncv ); 
  for(unsigned j=0;j<ncv;++j){
     Tools::convert( BiasGrid_->getMin()[j], dmin[j] );
     Tools::convert( BiasGrid_->getMax()[j], dmax[j] );
     grid_spacing[j] = ( dmax[j] - dmin[j] ) / static_cast<double>( rewf_grid_[j] );
-    grid_size *= grid_spacing[j]; 
     if( !getPntrToArgument(j)->isPeriodic() ) dmax[j] += grid_spacing[j]; 
     ntotgrid *= rewf_grid_[j];
  }
diff --git a/src/core/FlexibleBin.cpp b/src/core/FlexibleBin.cpp
index 8b286a14135e49cdfbfa2fbf49d7451543276c4d..3e01c39044e42ef52ce2ae22a62d3ec8ad5ad4e6 100644
--- a/src/core/FlexibleBin.cpp
+++ b/src/core/FlexibleBin.cpp
@@ -68,7 +68,7 @@ void FlexibleBin::update(bool nowAddAHill){
 	unsigned dimension=ncv*(ncv+1)/2;	
 	// this is done all the times from scratch. It is not an accumulator 
 	unsigned  k=0;
-	unsigned i,j;
+	unsigned i;
 	vector<double> cv;
 	vector<double> delta;
 	// if you use this below then the decay is in time units
@@ -104,7 +104,7 @@ void FlexibleBin::update(bool nowAddAHill){
 		}else{
 			k=0;
 			for(i=0;i<ncv;i++){
-				for(j=i;j<ncv;j++){ // upper diagonal loop
+				for(unsigned j=i;j<ncv;j++){ // upper diagonal loop
 					variance[k]+=decay*(delta[i]*delta[j]-variance[k]);
 					k++;
 				}
diff --git a/src/tools/OFile.cpp b/src/tools/OFile.cpp
index ebd837a2173b74bc53608c0aa87cf76b0ef7d5df..def2c449a50581baff289cd56a34583bc4b19364 100644
--- a/src/tools/OFile.cpp
+++ b/src/tools/OFile.cpp
@@ -265,7 +265,6 @@ void OFile::backupFile( const std::string& bstring, const std::string& fname ){
    if(maxbackup>0 && (!comm || comm->Get_rank()==0)){
      FILE* ff=std::fopen(const_cast<char*>(fname.c_str()),"r");
      if(ff){
-       FILE* fff=NULL;
        std::fclose(ff);
        std::string backup;
        size_t found=fname.find_last_of("/\\");
@@ -276,7 +275,7 @@ void OFile::backupFile( const std::string& bstring, const std::string& fname ){
          Tools::convert(i,num);
          if(i>maxbackup) plumed_merror("cannot backup file "+file+" maximum number of backup is "+num+"\n");
          backup=directory+bstring +"."+num+"."+file;
-         fff=std::fopen(backup.c_str(),"r");
+         FILE* fff=std::fopen(backup.c_str(),"r");
          if(!fff) break;
 	 else std::fclose(fff);
        }
diff --git a/src/tools/RMSD.cpp b/src/tools/RMSD.cpp
index b5cad41683682314630c4f67b4fc81d35a674d55..e10d90dcefe45a9c66eaba9220932b923ba88876 100644
--- a/src/tools/RMSD.cpp
+++ b/src/tools/RMSD.cpp
@@ -1051,7 +1051,6 @@ std::vector<Vector>  RMSDCoreData::getDDistanceDReferenceSOMA(){
   if(!isInitialized)plumed_merror("getDDistanceDReference to initialize the coreData first!");
   // get the transpose rotation
   Tensor t_rotation=rotation.transpose();
-  Tensor t_ddist_drr01=ddist_drr01.transpose();	
   
 // third expensive loop: derivatives
   for(unsigned iat=0;iat<n;iat++){