<?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: BUS_ADRALN - Invalid address alignment, while C program execution on HP-UX B.11.31 U ia64 in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/bus-adraln-invalid-address-alignment-while-c-program-execution/m-p/5678307#M638176</link>
    <description>&lt;P&gt;&amp;gt;RAW_TO_ORACLE_VARCHAR_W_SZ(addldata,&amp;nbsp;umsg-&amp;gt;iso.addldata + sizeof(size_t),&amp;nbsp;*(size_t*)(umsg-&amp;gt;iso.addldata));&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It could be aborting trying load up a 8 byte aligned size_t at addldata.&amp;nbsp; It appears that ct_rec is at least 8 byte aligned.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;gt;typedef struct {&lt;BR /&gt;&amp;nbsp; &amp;nbsp;...&lt;BR /&gt;&amp;nbsp; &amp;nbsp;isost iso;&lt;BR /&gt;} umf_ent;&lt;/P&gt;&lt;P&gt;typedef struct {&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;...&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;unsigned char addldata[1024];&lt;BR /&gt;} isost;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;These "..." are important.&amp;nbsp; Do they have any pointers there that would align addldata on an 8 byte boundary?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sun, 03 Jun 2012 10:12:31 GMT</pubDate>
    <dc:creator>Dennis Handly</dc:creator>
    <dc:date>2012-06-03T10:12:31Z</dc:date>
    <item>
      <title>BUS_ADRALN - Invalid address alignment, while C program execution on HP-UX B.11.31 U ia64</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/bus-adraln-invalid-address-alignment-while-c-program-execution/m-p/5678259#M638175</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;Please help to resolve problem for C program on&amp;nbsp;HP-UX B.11.31 U ia64, which is resulting in core dump while execution with&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;BUS_ADRALN error.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Program received signal SIGBUS, Bus error&lt;BR /&gt;si_code: 1 - BUS_ADRALN - Invalid address alignment. Please refer to the following link that helps in handling unaligned data: &lt;A href="http://docs.hp.com/en/7730/newhelp0610/pragmas.htm#pragma-pack-ex3." target="_blank"&gt;http://docs.hp.com/en/7730/newhelp0610/pragmas.htm#pragma-pack-ex3.&lt;/A&gt;&lt;BR /&gt;0x4000000000145280:1 in db_ins_curr_trans (umsg=0x87ffffffffff5920)&lt;BR /&gt;at ./dbcurrtran.pc:2528&lt;BR /&gt;&lt;STRONG&gt;2528 RAW_TO_ORACLE_VARCHAR_W_SZ( addldata,&lt;/STRONG&gt;&lt;BR /&gt;(gdb) bt&lt;BR /&gt;#0 0x4000000000145280:1 in db_ins_curr_trans (umsg=0x87ffffffffff5920)&lt;BR /&gt;at ./dbcurrtran.pc:2528&lt;BR /&gt;#1 0x40000000000c1250:0 in speedup_db () at speedup_db.c:86&lt;BR /&gt;#2 0x40000000000a8970:0 in main (argc=1, argv=0x87fffffffffff338)&lt;BR /&gt;at tserv.c:184&lt;BR /&gt;(gdb)&lt;BR /&gt;_Unwind_InfoBlock::decodeVUF: Unrecognized flags 200000000000&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is code list (partly):&lt;/P&gt;&lt;P&gt;int speedup_db( void )&lt;BR /&gt;{&lt;BR /&gt;&amp;nbsp; &amp;nbsp;umf_ent ct_rec;&lt;BR /&gt;&amp;nbsp; &amp;nbsp;memset( &amp;amp;ct_rec, 0, sizeof(umf_ent) );&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;db_ins_curr_trans( &amp;amp;ct_rec );&lt;/P&gt;&lt;P&gt;...&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;int db_ins_curr_trans( umf_ent *umsg )&lt;BR /&gt;{&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp; &amp;nbsp;RAW_TO_ORACLE_VARCHAR_W_SZ( addldata,&amp;nbsp;umsg-&amp;gt;iso.addldata + sizeof(size_t),&amp;nbsp;*(size_t*)(umsg-&amp;gt;iso.addldata) );&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;...&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;where&amp;nbsp;&lt;SPAN&gt;RAW_TO_ORACLE_VARCHAR_W_SZ is macro:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;#define RAW_TO_ORACLE_VARCHAR_W_SZ( dest, src, size ) \&lt;BR /&gt;raw_to_oracle_varchar( dest.arr, &amp;amp;dest.len, sizeof(dest.arr), src, size )&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;unsigned char *raw_to_oracle_varchar( unsigned char *dest, unsigned short *destlen,&amp;nbsp;size_t destsize,&amp;nbsp;const unsigned char *src, int srclen )&lt;BR /&gt;{&lt;BR /&gt;&amp;nbsp; &amp;nbsp;if( sizeof(char)*(2 * srclen) &amp;gt; destsize )&lt;BR /&gt;&amp;nbsp; &amp;nbsp;{&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; srclen = (destsize / sizeof(char)) / 2;&lt;BR /&gt;&amp;nbsp; &amp;nbsp;}&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;memset( (void *)dest, '\0', destsize );&lt;BR /&gt;&amp;nbsp; &amp;nbsp;*destlen = srclen * 2;&lt;BR /&gt;&amp;nbsp; &amp;nbsp;bchtoa( src, (char *)dest, srclen );&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;return dest;&lt;BR /&gt;} /* end of raw_to_oracle_varchar */&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;and umf_ent is a structure:&lt;/P&gt;&lt;P&gt;typedef struct&lt;BR /&gt;{&lt;BR /&gt;&amp;nbsp; &amp;nbsp;...&lt;BR /&gt;&amp;nbsp; &amp;nbsp;isost iso;&lt;BR /&gt;} umf_ent;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;typedef struct&lt;BR /&gt;{&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;...&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;unsigned char addldata[ 1024 ];&lt;BR /&gt;&amp;nbsp; &amp;nbsp;...&lt;BR /&gt;} isost;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 03 Jun 2012 07:54:06 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/bus-adraln-invalid-address-alignment-while-c-program-execution/m-p/5678259#M638175</guid>
      <dc:creator>Neolord</dc:creator>
      <dc:date>2012-06-03T07:54:06Z</dc:date>
    </item>
    <item>
      <title>Re: BUS_ADRALN - Invalid address alignment, while C program execution on HP-UX B.11.31 U ia64</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/bus-adraln-invalid-address-alignment-while-c-program-execution/m-p/5678307#M638176</link>
      <description>&lt;P&gt;&amp;gt;RAW_TO_ORACLE_VARCHAR_W_SZ(addldata,&amp;nbsp;umsg-&amp;gt;iso.addldata + sizeof(size_t),&amp;nbsp;*(size_t*)(umsg-&amp;gt;iso.addldata));&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It could be aborting trying load up a 8 byte aligned size_t at addldata.&amp;nbsp; It appears that ct_rec is at least 8 byte aligned.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;gt;typedef struct {&lt;BR /&gt;&amp;nbsp; &amp;nbsp;...&lt;BR /&gt;&amp;nbsp; &amp;nbsp;isost iso;&lt;BR /&gt;} umf_ent;&lt;/P&gt;&lt;P&gt;typedef struct {&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;...&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;unsigned char addldata[1024];&lt;BR /&gt;} isost;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;These "..." are important.&amp;nbsp; Do they have any pointers there that would align addldata on an 8 byte boundary?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 03 Jun 2012 10:12:31 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/bus-adraln-invalid-address-alignment-while-c-program-execution/m-p/5678307#M638176</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2012-06-03T10:12:31Z</dc:date>
    </item>
    <item>
      <title>Re: BUS_ADRALN - Invalid address alignment, while C program execution on HP-UX B.11.31 U ia64</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/bus-adraln-invalid-address-alignment-while-c-program-execution/m-p/5678357#M638177</link>
      <description>&lt;P&gt;Please find the header file attached, sorry for extradata in advance.&lt;/P&gt;</description>
      <pubDate>Sun, 03 Jun 2012 12:35:46 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/bus-adraln-invalid-address-alignment-while-c-program-execution/m-p/5678357#M638177</guid>
      <dc:creator>Neolord</dc:creator>
      <dc:date>2012-06-03T12:35:46Z</dc:date>
    </item>
    <item>
      <title>Re: BUS_ADRALN - Invalid address alignment, while C program execution on HP-UX B.11.31 U ia64</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/bus-adraln-invalid-address-alignment-while-c-program-execution/m-p/5678365#M638178</link>
      <description>&lt;P&gt;&amp;gt;Please find the header file attached, sorry for extra data in advance.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You are going to have to do your homework and let the compiler compute this offset info for us.&lt;/P&gt;&lt;P&gt;Add this to your program and supply the results:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;#include &amp;lt;stddef.h&amp;gt;&lt;/P&gt;&lt;P&gt;#include &amp;lt;stdio.h&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;printf("offset of addldata: %lu\n", offsetof(isost, addldata));&lt;/P&gt;&lt;P&gt;printf("offset of iso:%lu\n", offsetof(umf_ent, iso));&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is likely only a multiple of 4 and not 8 for 64 bit mode.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Or just go into the debugger and in db_ins_curr_trans, print out:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; p umsg-&amp;gt;iso.addldata&lt;/P&gt;</description>
      <pubDate>Sun, 03 Jun 2012 13:04:18 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/bus-adraln-invalid-address-alignment-while-c-program-execution/m-p/5678365#M638178</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2012-06-03T13:04:18Z</dc:date>
    </item>
    <item>
      <title>Re: BUS_ADRALN - Invalid address alignment, while C program execution on HP-UX B.11.31 U ia64</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/bus-adraln-invalid-address-alignment-while-c-program-execution/m-p/5678401#M638179</link>
      <description>&lt;P&gt;current &lt;SPAN&gt;results&lt;/SPAN&gt;:&lt;BR /&gt;offset of addldata: 1332&lt;BR /&gt;offset of iso: 816&lt;BR /&gt;(gdb) p umsg-&amp;gt;iso.addldata&lt;BR /&gt;$1 = '\000' &amp;lt;repeats 1023 times&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;so, now I've noticed that recently one field was added to umf structure and length of the other one was changed, so before these changes the result of &lt;SPAN&gt;offset of addldata was multiple of 8 and there was no BUS_ADRALN error raised&lt;/SPAN&gt;:&lt;BR /&gt;offset of addldata: 1312&lt;BR /&gt;offset of iso: 816&lt;/P&gt;&lt;P&gt;But even before changes it seems to be dangerous way to expect / fit this offset to be always multiple of 8 - sizeof(size_t). Am I right ?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 03 Jun 2012 14:36:51 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/bus-adraln-invalid-address-alignment-while-c-program-execution/m-p/5678401#M638179</guid>
      <dc:creator>Neolord</dc:creator>
      <dc:date>2012-06-03T14:36:51Z</dc:date>
    </item>
    <item>
      <title>Re: BUS_ADRALN - Invalid address alignment, while C program execution on HP-UX B.11.31 U ia64</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/bus-adraln-invalid-address-alignment-while-c-program-execution/m-p/5678439#M638180</link>
      <description>&lt;P&gt;&lt;SPAN class="login-bold"&gt;Dennis, thank you very much. I think now I undestand the problem with data alignment in the program and now have ideas how this should be resolved.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 03 Jun 2012 15:41:42 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/bus-adraln-invalid-address-alignment-while-c-program-execution/m-p/5678439#M638180</guid>
      <dc:creator>Neolord</dc:creator>
      <dc:date>2012-06-03T15:41:42Z</dc:date>
    </item>
    <item>
      <title>Re: BUS_ADRALN - Invalid address alignment, while C program execution on HP-UX B.11.31 U ia64</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/bus-adraln-invalid-address-alignment-while-c-program-execution/m-p/5678487#M638181</link>
      <description>&lt;P&gt;&amp;gt;offset of addldata: 1332&amp;nbsp; offset of iso: 816&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The sum of the two in hex is: 0x864&amp;nbsp; (so 4 byte aligned)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;gt;(gdb) p umsg-&amp;gt;iso.addldata&amp;nbsp; $1 = '\000' &amp;lt;repeats 1023 times&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I guess you needed to take the address: p &amp;amp;umsg-&amp;gt;iso.addldata[0]&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;gt;it seems to be dangerous way to expect / fit this offset to be always multiple of 8 - sizeof(size_t).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Easily solved.&amp;nbsp; Add an alignment bitfield:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; int ppmci;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; size_t :0;&amp;nbsp; // align next field&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; unsigned char addldata[UMF_ADDLDATA_SZ];&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="login-bold"&gt;&amp;gt;thank you very much.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="login-bold"&gt;If you are happy with the answers, please click on the Kudos stars.&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;offset of addldata: 1332&lt;BR /&gt;offset of iso: 816</description>
      <pubDate>Sun, 03 Jun 2012 21:06:06 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/bus-adraln-invalid-address-alignment-while-c-program-execution/m-p/5678487#M638181</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2012-06-03T21:06:06Z</dc:date>
    </item>
    <item>
      <title>Re: BUS_ADRALN - Invalid address alignment, while C program execution on HP-UX B.11.31 U ia64</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/bus-adraln-invalid-address-alignment-while-c-program-execution/m-p/5679201#M638182</link>
      <description>&lt;P&gt;&amp;gt;&amp;nbsp;&lt;SPAN&gt;I guess you needed to take the address: p &amp;amp;umsg-&amp;gt;iso.addldata[0]&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Да, извиняюсь:&lt;/P&gt;&lt;P&gt;(gdb) p &amp;amp;umsg.iso.addldata&lt;BR /&gt;$1 = (unsigned char (*)[1024]) 0x87ffffffffffdf74&lt;/P&gt;</description>
      <pubDate>Mon, 04 Jun 2012 09:58:07 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/bus-adraln-invalid-address-alignment-while-c-program-execution/m-p/5679201#M638182</guid>
      <dc:creator>Neolord</dc:creator>
      <dc:date>2012-06-04T09:58:07Z</dc:date>
    </item>
    <item>
      <title>Re: BUS_ADRALN - Invalid address alignment, while C program execution on HP-UX B.11.31 U ia64</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/bus-adraln-invalid-address-alignment-while-c-program-execution/m-p/5680091#M638183</link>
      <description>&lt;P&gt;&amp;gt;$1 = (unsigned char (*)[1024]) 0x87ffffffffffdf74&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This shows the alignment is just 4.&lt;/P&gt;</description>
      <pubDate>Tue, 05 Jun 2012 01:26:09 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/bus-adraln-invalid-address-alignment-while-c-program-execution/m-p/5680091#M638183</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2012-06-05T01:26:09Z</dc:date>
    </item>
  </channel>
</rss>

