HewlettPackard/cacti

uninitialized variables - undefined behavior - exposed with GCC 8

Opened this issue · 1 comments

The default configuration file (cache.cfg) when given as input to the cacti program compiled with GCC 8 crashes. Upon inspection, I found out that there are some uninitialized variables in InputParameter class; so, I fixed them like following.

diff --git a/io.cc b/io.cc
index 3a798aa..2983dfa 100644
--- a/io.cc
+++ b/io.cc
@@ -63,7 +63,10 @@ InputParameter::InputParameter()
  cl_power_gated(false),
  interconect_power_gated(false),
  power_gating(false),
- cl_vertical (true)
+ cl_vertical (true),
+ dram_ecc(NO_ECC),
+ io_type(DDR3),
+ dram_dimm(UDIMM)

This solves my assertion failures I was encountering earlier. However, the output with the default cache.cfg is still unexpected and different than what you would get if you compile it with older GCC versions like 4.8.

There are likely other uninitialized variables lying around; I found one more: num_se_rd_ports in InputParameter class doesn't get initialized when invoked with default cache.cfg