title: Fix for dereferencing type-punned pointer will break strict-aliasing
body: <p>I'm trying to fix two warnings when compiling a specific program using GCC.  The warnings are:</p>
  
  <p><strong>warning: dereferencing type-punned pointer will break
  strict-aliasing rules [-Wstrict-aliasing]</strong></p>
  
  <p>and the two culprits are:</p>
  
  <pre><code>unsigned int received_size = ntohl (*((unsigned int*)dcc-&gt;incoming_buf));
  </code></pre>
  
  <p>and</p>
  
  <pre><code>*((unsigned int*)dcc-&gt;outgoing_buf) = htonl (dcc-&gt;file_confirm_offset);
  </code></pre>
  
  <p><strong>incoming_buf</strong> and <strong>outgoing_buf</strong> are defined as follows:</p>
  
  <pre><code>char                    incoming_buf[LIBIRC_DCC_BUFFER_SIZE];
  
  char                    outgoing_buf[LIBIRC_DCC_BUFFER_SIZE];
  </code></pre>
  
  <p>This seems subtly different than the other examples of that warning I've been examining.  I would prefer to fix the problem rather than disable strict-aliasing checks.</p>
  
  <p>There have been many suggestions to use a union - what might be a suitable union for this case?</p>