From 9151a2e820e9bc30ac360aa7a0fe0cb205af13b9 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Fri, 18 Feb 2022 04:46:30 -0500 Subject: [PATCH] address unititialized data warnings from coverity scan --- src/GRANULAR/fix_wall_gran.cpp | 6 ++++-- src/ORIENT/fix_orient_bcc.h | 2 +- src/ORIENT/fix_orient_fcc.h | 2 +- src/region_cone.cpp | 2 +- 4 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/GRANULAR/fix_wall_gran.cpp b/src/GRANULAR/fix_wall_gran.cpp index 5f16176e49..256f6d6611 100644 --- a/src/GRANULAR/fix_wall_gran.cpp +++ b/src/GRANULAR/fix_wall_gran.cpp @@ -50,7 +50,7 @@ using namespace MathConst; // XYZ PLANE need to be 0,1,2 -enum {XPLANE=0,YPLANE=1,ZPLANE=2,ZCYLINDER,REGION}; +enum {NOSTYLE=-1,XPLANE=0,YPLANE=1,ZPLANE=2,ZCYLINDER,REGION}; enum {NONE,CONSTANT,EQUAL}; enum {DAMPING_NONE, VELOCITY, MASS_VELOCITY, VISCOELASTIC, TSUJI}; @@ -371,7 +371,7 @@ FixWallGran::FixWallGran(LAMMPS *lmp, int narg, char **arg) : wallstyle = REGION; idregion = utils::strdup(arg[iarg+1]); iarg += 2; - } + } else wallstyle = NOSTYLE; // optional args @@ -407,6 +407,8 @@ FixWallGran::FixWallGran(LAMMPS *lmp, int narg, char **arg) : } else error->all(FLERR,"Illegal fix wall/gran command"); } + if (wallstyle == NOSTYLE) + error->all(FLERR,"No wall style defined"); if (wallstyle == XPLANE && domain->xperiodic) error->all(FLERR,"Cannot use wall in periodic dimension"); if (wallstyle == YPLANE && domain->yperiodic) diff --git a/src/ORIENT/fix_orient_bcc.h b/src/ORIENT/fix_orient_bcc.h index 4a58ae0130..858b9bb1b4 100644 --- a/src/ORIENT/fix_orient_bcc.h +++ b/src/ORIENT/fix_orient_bcc.h @@ -69,7 +69,7 @@ class FixOrientBCC : public Fix { char *xifilename, *chifilename; // file names for 2 crystal orientations bool use_xismooth; - double Rxi[8][3], Rchi[8][3], half_xi_chi_vec[2][4][3]; + double Rxi[8][3] = {0}, Rchi[8][3] = {0}, half_xi_chi_vec[2][4][3] = {0}; double xiid, xi0, xi1, xicutoffsq, cutsq, added_energy; int half_bcc_nn; diff --git a/src/ORIENT/fix_orient_fcc.h b/src/ORIENT/fix_orient_fcc.h index a38c57daa1..6791672326 100644 --- a/src/ORIENT/fix_orient_fcc.h +++ b/src/ORIENT/fix_orient_fcc.h @@ -69,7 +69,7 @@ class FixOrientFCC : public Fix { char *xifilename, *chifilename; // file names for 2 crystal orientations bool use_xismooth; - double Rxi[12][3], Rchi[12][3], half_xi_chi_vec[2][6][3]; + double Rxi[8][3] = {0}, Rchi[8][3] = {0}, half_xi_chi_vec[2][4][3] = {0}; double xiid, xi0, xi1, xicutoffsq, cutsq, added_energy; int half_fcc_nn; diff --git a/src/region_cone.cpp b/src/region_cone.cpp index 886170c64a..9ee909a5d7 100644 --- a/src/region_cone.cpp +++ b/src/region_cone.cpp @@ -31,7 +31,7 @@ using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ RegCone::RegCone(LAMMPS *lmp, int narg, char **arg) : - Region(lmp, narg, arg) + Region(lmp, narg, arg), lo(0.0), hi(0.0) { options(narg-9,&arg[9]);