title: gcc exec if and else too... is this a bug?
body: <h1>Using gcc version 4.6.3 (Ubuntu/Linaro 4.6.3-1ubuntu5)</h1>
  <p>when using if else statements on pointer a:</p>
  <pre><code>if(a==NULL)
      ....
  else
     .....
  </code></pre>
  <p>both are executed. Can someone explain me?</p>
  <p>here part of code that implements a dinamic list with malloc c/c++ function.</p>
  <h1>compiling the code:</h1>
  <pre><code>#include &lt;iostream&gt;
  #include &lt;cstdlib&gt;
  using namespace std;
  struct simplelist {int v;struct simplelist *ptr;};
  void push(simplelist &amp;s,int value);
  void printlist(simplelist &amp;s);
  
  int main()
  {
  struct simplelist list; list.ptr=NULL;
  push(list,1); push(list,2); push(list,3); push(list,4);
  int v=0; v=getsize(list); cout&lt;&lt;&quot;size: &quot;&lt;&lt;v&lt;&lt;endl;
  return 0;
  }
  void push(simplelist &amp;s,int v)
  {
  if (s.ptr==NULL)
  {
      s.v=v;
      s.ptr=(simplelist *) malloc(sizeof(simplelist));
      if(s.ptr==NULL) cout&lt;&lt;&quot;out of memory&quot;&lt;&lt;endl; 
  }
  else
      push(*s.ptr,v);
  }
  
  int getsize(simplelist &amp;s)
  {
  int v=1;
  if (s.ptr==NULL)
      {
          v--;
          cout&lt;&lt;&quot;getsize s.ptr=null&quot;&lt;&lt;endl; //here bug?
      }                                     //program exec if and else statement
  
  else
  {
      v=v+getsize(*s.ptr);
      cout&lt;&lt;&quot;getsize elsewere&quot;&lt;&lt;endl;
  }
  
  
  return v;
  }
  </code></pre>
  <p>I got the output:</p>
  <pre><code>getsize s.ptr=null
  getsize elsewere
  getsize elsewere
  getsize elsewere
  getsize elsewere
  </code></pre>