cb-geo / mpm

CB-Geo High-Performance Material Point Method
https://www.cb-geo.com/research/mpm
Other
243 stars 83 forks source link

Static analysis #631

Closed kks32 closed 4 years ago

kks32 commented 4 years ago

Describe the PR Fix code based on the output of Static Analysis

  1. PVS Studio results
  2. Coverity static analysis https://scan.coverity.com/projects/cb-geo-mpm
  3. FB Infer didn't produce any issues

quadrilateral_element.tcc (767) | V592 | The expression was enclosed by parentheses  twice: '((bb * bb - 4 * aa * cc))'. One pair of parentheses is  unnecessary or misprint is present.
-- | -- | --
quadrilateral_element.tcc (770) | V592 | The expression was enclosed by parentheses  twice: '((bb * bb - 4 * aa * cc))'. One pair of parentheses is  unnecessary or misprint is present.
io_mesh_ascii.tcc (181) | V612 | An unconditional 'break' within a loop.
io_mesh_ascii.tcc (238) | V612 | An unconditional 'break' within a loop.
robin_hash.h (141) | V730 | Not all members of a class are initialized inside the constructor. Consider inspecting: m_value.
robin_hash.h (147) | V730 | Not all members of a class are initialized inside the constructor. Consider inspecting: m_value.
robin_hash.h (153) | V730 | Not all members of a class are initialized inside the constructor. Consider inspecting: m_value.
robin_hash.h (168) | V730 | Not all members of a class are initialized inside the constructor. Consider inspecting: m_value.
catch.hpp (2755) | V667 | The 'throw' operator does not possess any arguments and is not situated within the 'catch' block.
catch.hpp (4522) | V794 | The assignment operator should be protected from the case of 'this == &other'.
catch.hpp (5066) | V560 | A part of conditional expression is always true: m_throwOnUnrecognisedTokens.
catch.hpp (6677) | V1053 | Calling the 'aborting' virtual function in the destructor may lead to unexpected result at runtime.
catch.hpp (6999) | V690 | The copy assignment operator is declared  as private in the 'Version' class, but the default copy constructor will  still be generated by compiler. It is dangerous to use such a class.
catch.hpp (8034) | V536 | Be advised that the utilized constant value is represented by an octal form. Oct: '\033', Dec: 27.
catch.hpp (8204) | V648 | Priority of the '&&' operation is higher than that of the '\|\|' operation.
catch.hpp (9585) | V1051 | Consider checking for misprints. It's possible that the 'resultingReporter' should be checked here.
catch.hpp (10040) | V690 | The 'ScopedElement' class implements a  copy constructor, but lacks the copy assignment operator. It is  dangerous to use such a class.
catch.hpp (10604) | V1037 | Two or more case-branches perform the same actions. Check lines: 10604, 10607, 10610
mpicxx.h (176) | V730 | Not all members of a class are initialized inside the constructor. Consider inspecting: the_error_message.
mpicxx.h (177) | V730 | Not all members of a class are initialized inside the constructor. Consider inspecting: the_error_message.
mpicxx.h (182) | V730 | Not all members of a class are initialized inside the constructor. Consider inspecting: the_error_message.
task.h (579) | V1016 | The value 'bound + 1' is out of range of enum values. This causes unspecified or undefined behavior.
task.h (580) | V1016 | The value 'binding_completed + 1' is out of range of enum values. This causes unspecified or undefined behavior.
task.h (581) | V1016 | The value 'detached + 1' is out of range of enum values. This causes unspecified or undefined behavior.
tbb_allocator.h (97) | V547 | Expression 'max > 0' is always true.
modified_cam_clay.tcc (552) | V1051 | Consider checking for misprints. It's possible that the 'subloading_r' should be checked here.
particle.tcc (5) | V730 | It is possible that not all members of a  class are initialized inside the constructor. Consider inspecting:  mass_density_, dvolumetric_strain_.
particle.tcc (22) | V730 | It is possible that not all members of a  class are initialized inside the constructor. Consider inspecting:  mass_density_, dvolumetric_strain_.
StdOutput.h (285) | V781 | The value of the 'start' index is checked after it was used. Perhaps there is a mistake in program logic.
concurrent_vector.h (194) | V730 | Not all members of a class are initialized inside the constructor. Consider inspecting: vector_allocator_ptr.
concurrent_vector.h (1155) | V730 | Not all members of a class are initialized inside the constructor. Consider inspecting: k.
parallel_do.h (202) | V678 | An object is used as an argument to its own method. Consider checking the first actual argument of the 'destroy' function.
graph.tcc (44) | V519 | The 'start' variable is assigned values twice successively. Perhaps this is a mistake. Check lines: 43, 44.
task_group.h (150) | V509 | The 'throw' operator inside the destructor  should be placed within the try..catch block. Raising exception inside  the destructor is illegal.
injection.h (6) | V730 | Not all members of a class are initialized  inside the compiler generated constructor. Consider inspecting:  nparticles_dir, material_id, cell_set_id.
interface_test.cc (104) | V575 | The null pointer is passed into 'move' function. Inspect the first argument.
graph_test.cc (337) | V1030 | The 'mid' variable is used after it was moved.
graph_test.cc (604) | V1030 | The 'mid' variable is used after it was moved.
bingham_test.cc (107) | V561 | It's probably better to assign value to 'Dim' variable than to declare it anew. Previous declaration: bingham_test.cc, line 22.
bingham_test.cc (196) | V561 | It's probably better to assign value to 'Dim' variable than to declare it anew. Previous declaration: bingham_test.cc, line 22.
bingham_test.cc (291) | V561 | It's probably better to assign value to 'Dim' variable than to declare it anew. Previous declaration: bingham_test.cc, line 22.
bingham_test.cc (395) | V561 | It's probably better to assign value to 'Dim' variable than to declare it anew. Previous declaration: bingham_test.cc, line 22.
bingham_test.cc (559) | V561 | It's probably better to assign value to 'Dim' variable than to declare it anew. Previous declaration: bingham_test.cc, line 473.
bingham_test.cc (657) | V561 | It's probably better to assign value to 'Dim' variable than to declare it anew. Previous declaration: bingham_test.cc, line 473.
bingham_test.cc (768) | V561 | It's probably better to assign value to 'Dim' variable than to declare it anew. Previous declaration: bingham_test.cc, line 473.
bingham_test.cc (889) | V561 | It's probably better to assign value to 'Dim' variable than to declare it anew. Previous declaration: bingham_test.cc, line 473.
newtonian_test.cc (99) | V561 | It's probably better to assign value to  'Dim' variable than to declare it anew. Previous declaration:  newtonian_test.cc, line 22.
newtonian_test.cc (195) | V561 | It's probably better to assign value to  'Dim' variable than to declare it anew. Previous declaration:  newtonian_test.cc, line 22.
newtonian_test.cc (350) | V561 | It's probably better to assign value to  'Dim' variable than to declare it anew. Previous declaration:  newtonian_test.cc, line 273.
newtonian_test.cc (463) | V561 | It's probably better to assign value to  'Dim' variable than to declare it anew. Previous declaration:  newtonian_test.cc, line 273.
mpi_particle_test.cc (85) | V654 | The condition 'i < h5_particle.nstate_vars' of loop is always false.
mpi_particle_test.cc (85) | V621 | Consider inspecting the 'for' operator. It's possible that the loop will be executed incorrectly or won't be executed at all.
mesh_test_3d.cc (59) | V1030 | The 'mid' variable is used after it was moved.
mesh_test_2d.cc (67) | V1030 | The 'mid' variable is used after it was moved.
mpi_transfer_particle_test.cc (56) | V1030 | The 'mid' variable is used after it was moved.
mpi_transfer_particle_test.cc (328) | V581 | The conditional expressions of the 'if' statements situated alongside each other are identical. Check lines: 287, 328.
mpi_transfer_particle_test.cc (391) | V1030 | The 'mid' variable is used after it was moved.
mpi_transfer_particle_test.cc (700) | V581 | The conditional expressions of the 'if' statements situated alongside each other are identical. Check lines: 648, 700.
node_test.cc (223) | V547 | Expression 'i == Direction' is always true.
node_test.cc (238) | V547 | Expression 'i == Direction' is always true.
particle_test.cc (190) | V547 | Expression 'i == Direction' is always true.
particle_test.cc (202) | V547 | Expression 'i == Direction' is always true.
particle_test.cc (1104) | V561 | It's probably better to assign value to  'mid' variable than to declare it anew. Previous declaration:  particle_test.cc, line 715.
particle_test.cc (2356) | V561 | It's probably better to assign value to  'mid' variable than to declare it anew. Previous declaration:  particle_test.cc, line 1973.
mohr_coulomb_test.cc (136) | V1030 | The 'id' variable is used after it was moved.
mohr_coulomb_test.cc (395) | V1030 | The 'id' variable is used after it was moved.
mohr_coulomb_test.cc (602) | V1030 | The 'id' variable is used after it was moved.
mohr_coulomb_test.cc (857) | V1030 | The 'id' variable is used after it was moved.
mohr_coulomb_test.cc (1066) | V1030 | The 'id' variable is used after it was moved.
mohr_coulomb_test.cc (1321) | V1030 | The 'id' variable is used after it was moved.
mohr_coulomb_test.cc (1529) | V1030 | The 'id' variable is used after it was moved.
mohr_coulomb_test.cc (2007) | V1030 | The 'id' variable is used after it was moved.
mohr_coulomb_test.cc (2519) | V1030 | The 'id' variable is used after it was moved.
mohr_coulomb_test.cc (3025) | V1030 | The 'id' variable is used after it was moved.
codecov[bot] commented 4 years ago

Codecov Report

Merging #631 into develop will increase coverage by 0.00%. The diff coverage is 90.91%.

Impacted file tree graph

@@           Coverage Diff            @@
##           develop     #631   +/-   ##
========================================
  Coverage    97.00%   97.00%           
========================================
  Files          123      123           
  Lines        25480    25468   -12     
========================================
- Hits         24716    24705   -11     
+ Misses         764      763    -1     
Impacted Files Coverage Δ
include/elements/2d/quadrilateral_element.tcc 80.31% <0.00%> (ø)
include/graph.tcc 97.56% <ø> (+1.18%) :arrow_up:
include/particles/particle.h 100.00% <ø> (ø)
tests/materials/bingham_test.cc 100.00% <ø> (ø)
tests/materials/newtonian_test.cc 100.00% <ø> (ø)
include/particles/particle.tcc 94.19% <100.00%> (ø)
tests/graph_test.cc 100.00% <100.00%> (ø)
tests/materials/mohr_coulomb_test.cc 99.91% <100.00%> (ø)
tests/mesh_test_2d.cc 98.40% <100.00%> (ø)
tests/mesh_test_3d.cc 98.61% <100.00%> (ø)
... and 2 more

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update cb2d244...b5b72ef. Read the comment docs.