title: MISRA C 2012 Rule 9.1 Reading uninitialized value
body: <p>I am facing scenario where rule 9.1 getting violated. 
  I want to read an auto variable(having garbage value while declaring) before initialization and to assign null if it is not null. If it is null, then with different value. 
  Sample code: </p>
  
  <pre><code>{ 
      int8_t reg_num; 
      uint64_t var1[NUM]; 
      for (reg_num = 0; reg_num &lt; NUM; reg_num++) {
          if (var1[reg_num] != VAR_NULL) { 
              var1 [reg_num] = VAR_NULL; 
          } else { 
              var1[reg_num] = func1(); 
          } 
      } 
  }
  </code></pre>
  
  <p>Violation is for the line <code>if (var1[reg_num] != VAR_NULL)</code> where <code>var1[reg_num]</code> is reading before initialization. </p>
  
  <p>Is there any way to write the same code without violating 9.1</p>