<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: type-punned pointers!? in Operating System - Linux</title>
    <link>https://community.hpe.com/t5/operating-system-linux/type-punned-pointers/m-p/3803216#M99941</link>
    <description>&amp;gt;I don't really understand why 'clean' code would give such a warning since it's structures which are defined by the system. &lt;BR /&gt;&lt;BR /&gt;The trouble is that the system headers think they can do anything but don't realize they break strict ANSI C rules.  ;-)&lt;BR /&gt;&lt;BR /&gt;You probably can ignore this.  I don't know if there is a g++ option to suppress this.  Or if the warning will tell g++ not to do that aliasing.</description>
    <pubDate>Fri, 09 Jun 2006 15:29:10 GMT</pubDate>
    <dc:creator>Dennis Handly</dc:creator>
    <dc:date>2006-06-09T15:29:10Z</dc:date>
    <item>
      <title>type-punned pointers!?</title>
      <link>https://community.hpe.com/t5/operating-system-linux/type-punned-pointers/m-p/3803215#M99940</link>
      <description>Hi, &lt;BR /&gt;&lt;BR /&gt;I'm seeing a weird problem on hp-ux (ia64) using g++ 4.1.1. &lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Here below is a tiny bit of code which sets up the nessecary code for doing &lt;BR /&gt;a select(): &lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;fd_set fdread, fdwrite; &lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;FD_ZERO(&amp;amp;fdread); &lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;FD_ZERO(&amp;amp;fdwrite); &lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;FD_SET(m_IncomingSocket.GetSocket(), &amp;amp;fdread); &lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;FD_SET(m_IncomingSocket.GetSocket(), &amp;amp;fdwrite); &lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;For the last two lines I get the following warning: &lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;warning: dereferencing type-punned pointer will break strict-aliasing rules &lt;BR /&gt;warning: dereferencing type-punned pointer will break strict-aliasing rules &lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;I don't really understand why 'clean' code would give such a warning since &lt;BR /&gt;it's structures which are defined by the system. &lt;BR /&gt;However perhaps someone could tell me what it actually means and eventually &lt;BR /&gt;how to solve it? My g++ optimization is O2. &lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Thanks in advance. &lt;BR /&gt;-- Henrik &lt;BR /&gt;</description>
      <pubDate>Fri, 09 Jun 2006 08:16:48 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/type-punned-pointers/m-p/3803215#M99940</guid>
      <dc:creator>Henrik Goldman</dc:creator>
      <dc:date>2006-06-09T08:16:48Z</dc:date>
    </item>
    <item>
      <title>Re: type-punned pointers!?</title>
      <link>https://community.hpe.com/t5/operating-system-linux/type-punned-pointers/m-p/3803216#M99941</link>
      <description>&amp;gt;I don't really understand why 'clean' code would give such a warning since it's structures which are defined by the system. &lt;BR /&gt;&lt;BR /&gt;The trouble is that the system headers think they can do anything but don't realize they break strict ANSI C rules.  ;-)&lt;BR /&gt;&lt;BR /&gt;You probably can ignore this.  I don't know if there is a g++ option to suppress this.  Or if the warning will tell g++ not to do that aliasing.</description>
      <pubDate>Fri, 09 Jun 2006 15:29:10 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/type-punned-pointers/m-p/3803216#M99941</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2006-06-09T15:29:10Z</dc:date>
    </item>
    <item>
      <title>Re: type-punned pointers!?</title>
      <link>https://community.hpe.com/t5/operating-system-linux/type-punned-pointers/m-p/3803217#M99942</link>
      <description>Yes it seems it's a bug in the system headers.&lt;BR /&gt;&lt;BR /&gt;For now I just fixed the header file /usr/include/sys/_fd_macros.h:&lt;BR /&gt;&lt;BR /&gt;#    define FD_SET(n,p)  (((__fd_mask *)(void*)((p)-&amp;gt;fds_bits))[(n)/_NFDBITS] |...&lt;BR /&gt;#    define FD_CLR(n,p) (((__fd_mask *)(void*)((p)-&amp;gt;fds_bits))[(n)/_NFDBITS] &amp;amp;=...&lt;BR /&gt;#    define FD_ISSET(n,p) (((__fd_mask *)(void*)((p)-&amp;gt;fds_bits))[(n)/_NFDBITS] ...&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;I have added "(void *)" on all 3 lines. I think it's because the cast is unsafe that I get the complain. On other platforms I'm sure the same thing would have issued "bus errors" which I have experienced in past.&lt;BR /&gt;&lt;BR /&gt;-- Henrik</description>
      <pubDate>Fri, 09 Jun 2006 15:50:53 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/type-punned-pointers/m-p/3803217#M99942</guid>
      <dc:creator>Henrik Goldman</dc:creator>
      <dc:date>2006-06-09T15:50:53Z</dc:date>
    </item>
  </channel>
</rss>

