diff --git a/src/colvar/ContactMap.cpp b/src/colvar/ContactMap.cpp
index 07fda44d747db13541bec406c37585ad9b644d9d..8f81f226f3771cfc1cfabc04b7e629b987e4b511 100644
--- a/src/colvar/ContactMap.cpp
+++ b/src/colvar/ContactMap.cpp
@@ -271,8 +271,8 @@ void ContactMap::calculate() {
   Tensor virial;
   std::vector<Vector> deriv(getNumberOfAtoms());
 
-  unsigned stride=comm.Get_size();
-  unsigned rank=comm.Get_rank();
+  unsigned stride;
+  unsigned rank;
   if(serial) {
     // when using components the parallelisation do not work
     stride=1;
diff --git a/src/colvar/CoordinationBase.cpp b/src/colvar/CoordinationBase.cpp
index 75040505ae7ab4f2f7c666769f4d371f6945a83e..2a1d34120da3e409c5a3f6531eb8f356cb348eca 100644
--- a/src/colvar/CoordinationBase.cpp
+++ b/src/colvar/CoordinationBase.cpp
@@ -140,8 +140,8 @@ void CoordinationBase::calculate()
     nl->update(getPositions());
   }
 
-  unsigned stride=comm.Get_size();
-  unsigned rank=comm.Get_rank();
+  unsigned stride;
+  unsigned rank;
   if(serial) {
     stride=1;
     rank=0;
diff --git a/src/generic/EffectiveEnergyDrift.cpp b/src/generic/EffectiveEnergyDrift.cpp
index f4185c0fc638f2603c5ef5637f6f2e176e95dc11..8debb8a8045945d46821a963a8105ea3d09c8a21 100644
--- a/src/generic/EffectiveEnergyDrift.cpp
+++ b/src/generic/EffectiveEnergyDrift.cpp
@@ -222,8 +222,6 @@ void EffectiveEnergyDrift::update() {
     pNLocalAtoms = pGatindex.size();
     pPositions=positions;
     pForces=forces;
-    pPositions=positions;
-    pForces=forces;
     pbox=box;
     pfbox=fbox;
     initialBias=plumed.getBias();
diff --git a/src/gridtools/GridToXYZ.cpp b/src/gridtools/GridToXYZ.cpp
index fd22d2a88f651dac39c5a6cebc7d81eaff43d9bd..d2d8365bdaf1018fc1193b18b6b6b380253feed8 100644
--- a/src/gridtools/GridToXYZ.cpp
+++ b/src/gridtools/GridToXYZ.cpp
@@ -97,7 +97,8 @@ void GridToXYZ::printGrid( OFile& ofile ) const {
   ofile.printf("Grid converted to xyz file \n");
   for(unsigned i=0; i<ingrid->getNumberOfPoints(); ++i) {
     ingrid->getGridPointCoordinates( i, point );
-    ofile.printf("X"); double val=ingrid->getGridElement( i, 0 );
+    ofile.printf("X");
+    double val;
     if( ingrid->getType()=="flat" ) val=1.0;
     else val=ingrid->getGridElement( i, 0 );
     for(unsigned j=0; j<3; ++j) { ofile.printf( (" " + fmt).c_str(), val*lenunit*point[j] ); }
diff --git a/src/tools/Communicator.cpp b/src/tools/Communicator.cpp
index 48acdd3458f9f7c5667bcf8e98c7a84e4141359a..17e836041f1e998326e90fd243efa38168aeaab4 100644
--- a/src/tools/Communicator.cpp
+++ b/src/tools/Communicator.cpp
@@ -34,20 +34,12 @@ Communicator::Communicator()
 {
 }
 
-// cppcheck complains about this:
-// Member variable 'Communicator::communicator' is not initialized in the constructor
-// this is a false positive so I suppress it
-// cppcheck-suppress uninitMemberVar
 Communicator::Communicator(const Communicator&pc) {
   Set_comm(pc.communicator);
 }
 
 Communicator::Status Communicator::StatusIgnore;
 
-// cppcheck complains about this:
-// Member variable 'Communicator::communicator' is not assigned a value in 'Communicator::operator='
-// this is a false positive so I suppress it
-// cppcheck-suppress operatorEqVarError
 Communicator& Communicator::operator=(const Communicator&pc) {
   if (this != &pc) {
     Set_comm(pc.communicator);
diff --git a/src/tools/MolDataClass.cpp b/src/tools/MolDataClass.cpp
index 107ed2ee3d5725d2d54308a2f8e92e0da785653c..fa7ddd301fe1972bb47678610985fb70cf9b5346 100644
--- a/src/tools/MolDataClass.cpp
+++ b/src/tools/MolDataClass.cpp
@@ -206,7 +206,6 @@ void MolDataClass::specialSymbol( const std::string& type, const std::string& sy
     std::string chainid;
     if(firstnum==dash+1) {
       Tools::convert( symbol.substr(dash+1), resnum );
-      resname= mypdb.getResidueName(resnum);
       chainid="*"; // this is going to match the first chain
     } else {
       // if chain id is provided: