<?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: Bad structure alignment in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/bad-structure-alignment/m-p/3314132#M711915</link>
    <description>Compile/link this with the debugging data flag enabled (-g?) and no optimization and then let it die and use the debugger to examine the dump and do a stack trace. This should zero in on the problem -- down to the offending source line. There is nothing wrong with your struct per se although you might be hitting a limit on maximum struct size --- but I doubt it. I'm simply not up to speed on gcc because I don't use it.</description>
    <pubDate>Thu, 24 Jun 2004 14:48:18 GMT</pubDate>
    <dc:creator>A. Clay Stephenson</dc:creator>
    <dc:date>2004-06-24T14:48:18Z</dc:date>
    <item>
      <title>Bad structure alignment</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/bad-structure-alignment/m-p/3314130#M711913</link>
      <description>Hi&lt;BR /&gt;&lt;BR /&gt;I have a structure&lt;BR /&gt;typedef struct ipc_msg {&lt;BR /&gt;int msg_size;&lt;BR /&gt;char msg_data[1024 * 32];&lt;BR /&gt;}ipc_msg;&lt;BR /&gt;&lt;BR /&gt;In a function a local variable of this structure type is declared and used. The function definition looks like:&lt;BR /&gt;----------------------------------&lt;BR /&gt;int sic_recvmsg(socket_ipc_client *sic, void * msg_data)&lt;BR /&gt;{&lt;BR /&gt;int ret;&lt;BR /&gt;ipc_msg msg;&lt;BR /&gt;ret = recv_all(SIC_REC-&amp;gt;socket, &amp;amp;msg, 0);&lt;BR /&gt;....&lt;BR /&gt;----------------------&lt;BR /&gt;&lt;BR /&gt;The problem is that when never I call this function, I get SIGBUS. The last line in coredump is start of function.&lt;BR /&gt;When I see the address of 'msg', it gives 0x79739f88. As the sizeof ipc_msg is 32772(32768 + 4), the address is not properly aligned and i guess this is the problem.&lt;BR /&gt;&lt;BR /&gt;Can anybody tell me why this is happening?&lt;BR /&gt;&lt;BR /&gt;I am using gcc 3.3.3 on HP-UX 11.11.&lt;BR /&gt;&lt;BR /&gt;Thanks in advance&lt;BR /&gt;Rohan</description>
      <pubDate>Thu, 24 Jun 2004 05:26:36 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/bad-structure-alignment/m-p/3314130#M711913</guid>
      <dc:creator>Rohan_7</dc:creator>
      <dc:date>2004-06-24T05:26:36Z</dc:date>
    </item>
    <item>
      <title>Re: Bad structure alignment</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/bad-structure-alignment/m-p/3314131#M711914</link>
      <description>0x79739f88 is properly aligned.&lt;BR /&gt;Look more closely at what code and address&lt;BR /&gt;is generating the SIGBUS.  There isn't enough information here to tell what is causing the SIGBUS.  If I had to make a guess I would expect to see that "SIC_REC-&amp;gt;socket" uses the "sic" parameter and that was passed in as a bad pointer.&lt;BR /&gt;</description>
      <pubDate>Thu, 24 Jun 2004 14:38:31 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/bad-structure-alignment/m-p/3314131#M711914</guid>
      <dc:creator>Mike Stroyan</dc:creator>
      <dc:date>2004-06-24T14:38:31Z</dc:date>
    </item>
    <item>
      <title>Re: Bad structure alignment</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/bad-structure-alignment/m-p/3314132#M711915</link>
      <description>Compile/link this with the debugging data flag enabled (-g?) and no optimization and then let it die and use the debugger to examine the dump and do a stack trace. This should zero in on the problem -- down to the offending source line. There is nothing wrong with your struct per se although you might be hitting a limit on maximum struct size --- but I doubt it. I'm simply not up to speed on gcc because I don't use it.</description>
      <pubDate>Thu, 24 Jun 2004 14:48:18 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/bad-structure-alignment/m-p/3314132#M711915</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2004-06-24T14:48:18Z</dc:date>
    </item>
    <item>
      <title>Re: Bad structure alignment</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/bad-structure-alignment/m-p/3314133#M711916</link>
      <description>Hi &lt;BR /&gt;&lt;BR /&gt;Thanks a lot for your responses.&lt;BR /&gt;&lt;BR /&gt;It turned out to be a different issue!&lt;BR /&gt;Thread was hitting the maximum stack size allowed and hence it was giving the SIGBUS.&lt;BR /&gt;After increasing the max allowed thread size, its running properly.&lt;BR /&gt;&lt;BR /&gt;Thanks again.&lt;BR /&gt;Rohan&lt;BR /&gt;</description>
      <pubDate>Thu, 24 Jun 2004 23:21:14 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/bad-structure-alignment/m-p/3314133#M711916</guid>
      <dc:creator>Rohan_7</dc:creator>
      <dc:date>2004-06-24T23:21:14Z</dc:date>
    </item>
  </channel>
</rss>

