<?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 iconv cause core dump in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/iconv-cause-core-dump/m-p/4283021#M671995</link>
    <description>I have function convert（args...)to convert hp15CN to utf8&lt;BR /&gt;&lt;BR /&gt;In a simple program, it works fine.&lt;BR /&gt;#include &lt;STDIO.H&gt;&lt;BR /&gt;#include &lt;STDLIB.H&gt;&lt;BR /&gt;#include &lt;STRING.H&gt;&lt;BR /&gt;#include &lt;ICONV.H&gt;&lt;BR /&gt;int Convert(char* encFrom, char* encTo, const char* in, int in_len, char* out, int out_len)&lt;BR /&gt;{&lt;BR /&gt;        char* sin, *sout;&lt;BR /&gt;        int ret;&lt;BR /&gt;        iconv_t c_pt;&lt;BR /&gt;        int ilen, olen;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;        printf("1\n");&lt;BR /&gt;        if((c_pt = iconv_open(encTo, encFrom)) == (iconv_t)-1)&lt;BR /&gt;        {&lt;BR /&gt;                printf("c_pt == -1\n");&lt;BR /&gt;                return -1;&lt;BR /&gt;        }&lt;BR /&gt;        iconv(c_pt, NULL, NULL, NULL, NULL);&lt;BR /&gt;        sin = (char*)in;&lt;BR /&gt;        sout = (char*)out;&lt;BR /&gt;        ilen = in_len;&lt;BR /&gt;        olen = out_len;&lt;BR /&gt;&lt;BR /&gt;        printf("2\n");&lt;BR /&gt;        ret = iconv(c_pt, &amp;amp;sin, (size_t*)&amp;amp;in_len, &amp;amp;sout, (size_t*)&amp;amp;out_len);&lt;BR /&gt;        printf("3\n");&lt;BR /&gt;        if(ret == -1)&lt;BR /&gt;        {&lt;BR /&gt;                iconv_close(c_pt);&lt;BR /&gt;                printf("iconv error\n");&lt;BR /&gt;                return -1;&lt;BR /&gt;        }&lt;BR /&gt;        iconv_close(c_pt);&lt;BR /&gt;        return 1;&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;int main()&lt;BR /&gt;{&lt;BR /&gt;        char buf[50];&lt;BR /&gt;&lt;BR /&gt;        char* str = "  ???/PLASTIC SHEET (5M)";&lt;BR /&gt;        memset(buf, '\0', sizeof(buf));&lt;BR /&gt;        Convert("hp15CN", "utf8", str, strlen(str), buf, sizeof(buf));&lt;BR /&gt;        printf("buf = %s\n", buf);&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;output:&lt;BR /&gt;1&lt;BR /&gt;2&lt;BR /&gt;3&lt;BR /&gt;buf =   ?PLASTIC SHEET (5M)&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;but the functioon in my another program(run in the same machine), it caursed core.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;see the attached files.&lt;BR /&gt;&lt;BR /&gt;Anybody who can help me?&lt;/ICONV.H&gt;&lt;/STRING.H&gt;&lt;/STDLIB.H&gt;&lt;/STDIO.H&gt;</description>
    <pubDate>Wed, 08 Oct 2008 09:10:35 GMT</pubDate>
    <dc:creator>yuyuguang</dc:creator>
    <dc:date>2008-10-08T09:10:35Z</dc:date>
    <item>
      <title>iconv cause core dump</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/iconv-cause-core-dump/m-p/4283021#M671995</link>
      <description>I have function convert（args...)to convert hp15CN to utf8&lt;BR /&gt;&lt;BR /&gt;In a simple program, it works fine.&lt;BR /&gt;#include &lt;STDIO.H&gt;&lt;BR /&gt;#include &lt;STDLIB.H&gt;&lt;BR /&gt;#include &lt;STRING.H&gt;&lt;BR /&gt;#include &lt;ICONV.H&gt;&lt;BR /&gt;int Convert(char* encFrom, char* encTo, const char* in, int in_len, char* out, int out_len)&lt;BR /&gt;{&lt;BR /&gt;        char* sin, *sout;&lt;BR /&gt;        int ret;&lt;BR /&gt;        iconv_t c_pt;&lt;BR /&gt;        int ilen, olen;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;        printf("1\n");&lt;BR /&gt;        if((c_pt = iconv_open(encTo, encFrom)) == (iconv_t)-1)&lt;BR /&gt;        {&lt;BR /&gt;                printf("c_pt == -1\n");&lt;BR /&gt;                return -1;&lt;BR /&gt;        }&lt;BR /&gt;        iconv(c_pt, NULL, NULL, NULL, NULL);&lt;BR /&gt;        sin = (char*)in;&lt;BR /&gt;        sout = (char*)out;&lt;BR /&gt;        ilen = in_len;&lt;BR /&gt;        olen = out_len;&lt;BR /&gt;&lt;BR /&gt;        printf("2\n");&lt;BR /&gt;        ret = iconv(c_pt, &amp;amp;sin, (size_t*)&amp;amp;in_len, &amp;amp;sout, (size_t*)&amp;amp;out_len);&lt;BR /&gt;        printf("3\n");&lt;BR /&gt;        if(ret == -1)&lt;BR /&gt;        {&lt;BR /&gt;                iconv_close(c_pt);&lt;BR /&gt;                printf("iconv error\n");&lt;BR /&gt;                return -1;&lt;BR /&gt;        }&lt;BR /&gt;        iconv_close(c_pt);&lt;BR /&gt;        return 1;&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;int main()&lt;BR /&gt;{&lt;BR /&gt;        char buf[50];&lt;BR /&gt;&lt;BR /&gt;        char* str = "  ???/PLASTIC SHEET (5M)";&lt;BR /&gt;        memset(buf, '\0', sizeof(buf));&lt;BR /&gt;        Convert("hp15CN", "utf8", str, strlen(str), buf, sizeof(buf));&lt;BR /&gt;        printf("buf = %s\n", buf);&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;output:&lt;BR /&gt;1&lt;BR /&gt;2&lt;BR /&gt;3&lt;BR /&gt;buf =   ?PLASTIC SHEET (5M)&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;but the functioon in my another program(run in the same machine), it caursed core.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;see the attached files.&lt;BR /&gt;&lt;BR /&gt;Anybody who can help me?&lt;/ICONV.H&gt;&lt;/STRING.H&gt;&lt;/STDLIB.H&gt;&lt;/STDIO.H&gt;</description>
      <pubDate>Wed, 08 Oct 2008 09:10:35 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/iconv-cause-core-dump/m-p/4283021#M671995</guid>
      <dc:creator>yuyuguang</dc:creator>
      <dc:date>2008-10-08T09:10:35Z</dc:date>
    </item>
    <item>
      <title>Re: iconv cause core dump</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/iconv-cause-core-dump/m-p/4283022#M671996</link>
      <description>but the functioon in my another program(run in the same machine), it caursed core.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;int Convert(char* encFrom, char* encTo, const char* in, int in_len, char* out, int out_len)&lt;BR /&gt;{&lt;BR /&gt;        char* sin, *sout;&lt;BR /&gt;        int ret;&lt;BR /&gt;        iconv_t c_pt;&lt;BR /&gt;        int ilen, olen;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;        printf("1\n");&lt;BR /&gt;        if((c_pt = iconv_open(encTo, encFrom)) == (iconv_t)-1)&lt;BR /&gt;        {&lt;BR /&gt;                printf("c_pt == -1\n");&lt;BR /&gt;                return -1;&lt;BR /&gt;        }&lt;BR /&gt;        iconv(c_pt, NULL, NULL, NULL, NULL);&lt;BR /&gt;        sin = (char*)in;&lt;BR /&gt;        sout = (char*)out;&lt;BR /&gt;        ilen = in_len;&lt;BR /&gt;        olen = out_len;&lt;BR /&gt;&lt;BR /&gt;        printf("2\n");&lt;BR /&gt;        ret = iconv(c_pt, &amp;amp;sin, (size_t*)&amp;amp;in_len, &amp;amp;sout, (size_t*)&amp;amp;out_len);&lt;BR /&gt;        printf("3\n");&lt;BR /&gt;        if(ret == -1)&lt;BR /&gt;        {&lt;BR /&gt;                iconv_close(c_pt);&lt;BR /&gt;                printf("iconv error\n");&lt;BR /&gt;                return -1;&lt;BR /&gt;        }&lt;BR /&gt;        iconv_close(c_pt);&lt;BR /&gt;        return 1;&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;Invorking the Convert function&lt;BR /&gt;ret = Convert("hp15CN", "utf8", fli_sup-&amp;gt;supplies_desc, strlen(fli_sup-&amp;gt;supplies_desc)+1, temp_buf, sizeof(temp_buf)-&lt;BR /&gt;1);&lt;BR /&gt;        if(ret &amp;lt; 0)&lt;BR /&gt;        {&lt;BR /&gt;                xmlFreeDoc(doc);&lt;BR /&gt;                return GBK_TO_UTF8_ERROR;&lt;BR /&gt;        }&lt;BR /&gt;&lt;BR /&gt;output:&lt;BR /&gt;sup_desc1=???/PLASTIC SHEET (5M), sup_desc2=???/PLASTIC SHEET (5M)&lt;BR /&gt;test 1&lt;BR /&gt;1&lt;BR /&gt;2&lt;BR /&gt;3&lt;BR /&gt;sin=adfasdf, sout=, ilen=7, olen=50&lt;BR /&gt;Bus error(coredump)</description>
      <pubDate>Wed, 08 Oct 2008 09:12:37 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/iconv-cause-core-dump/m-p/4283022#M671996</guid>
      <dc:creator>yuyuguang</dc:creator>
      <dc:date>2008-10-08T09:12:37Z</dc:date>
    </item>
    <item>
      <title>Re: iconv cause core dump</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/iconv-cause-core-dump/m-p/4283023#M671997</link>
      <description>Following are gdb messages&lt;BR /&gt;Detected 64-bit executable.&lt;BR /&gt;Invoking /opt/langtools/bin/gdb64.&lt;BR /&gt;HP gdb 3.2 for PA-RISC 2.0 (wide), HP-UX 11.00.&lt;BR /&gt;Copyright 1986 - 2001 Free Software Foundation, Inc.&lt;BR /&gt;Hewlett-Packard Wildebeest 3.2 (based on GDB) is covered by the&lt;BR /&gt;GNU General Public License. Type "show copying" to see the conditions to&lt;BR /&gt;change it and/or distribute copies. Type "show warranty" for warranty/support.&lt;BR /&gt;..(no debugging symbols found)...&lt;BR /&gt;Core was generated by `exdatass'.&lt;BR /&gt;Program terminated with signal 10, Bus error.&lt;BR /&gt;(no debugging symbols found)...&lt;BR /&gt;warning: The shared libraries were not privately mapped; setting a&lt;BR /&gt;breakpoint in a shared library will not work until you rerun the program.&lt;BR /&gt;&lt;BR /&gt;(no debugging symbols found)...(no debugging symbols found)...(no debugging symbols found)...&lt;BR /&gt;(no debugging symbols found)...(no debugging symbols found)...(no debugging symbols found)...(no debugging symbols found)...&lt;BR /&gt;(no debugging symbols found)...(no debugging symbols found)...(no debugging symbols found)...&lt;BR /&gt;warning: section .data not found in /oradata/orabase/product/9.2.0/lib/libwtc9.sl&lt;BR /&gt;(no debugging symbols found)...&lt;BR /&gt;(no debugging symbols found)...(no debugging symbols found)...(no debugging symbols found)...&lt;BR /&gt;#0  0xc00000000004d898 in _instantiate_iconv+0x2f8 () from /usr/lib/nls/iconv/pa20_64/methods.2/lhp15utf8.sl&lt;BR /&gt;(gdb) where&lt;BR /&gt;#0  0xc00000000004d898 in _instantiate_iconv+0x2f8 () from /usr/lib/nls/iconv/pa20_64/methods.2/lhp15utf8.sl&lt;BR /&gt;#1  0xc000000000315200 in iconv+0x30 () from /usr/lib/pa20_64/libc.2&lt;BR /&gt;#2  0x400000000001920c in Convert1+0x244 ()&lt;BR /&gt;#3  0x400000000001d768 in ProcessFlightSupply+0x358 ()&lt;BR /&gt;#4  0x400000000000e7d4 in GetFlightSupplies+0x12fc ()&lt;BR /&gt;#5  0x400000000001855c in main+0x11b4 ()&lt;BR /&gt;(gdb) quit&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;machine info:&lt;BR /&gt;uname -a&lt;BR /&gt;HP-UX training B.11.11 U 9000/800 3112192028 unlimited-user license&lt;BR /&gt;&lt;BR /&gt;It's a strange problem.</description>
      <pubDate>Wed, 08 Oct 2008 09:16:22 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/iconv-cause-core-dump/m-p/4283023#M671997</guid>
      <dc:creator>yuyuguang</dc:creator>
      <dc:date>2008-10-08T09:16:22Z</dc:date>
    </item>
    <item>
      <title>Re: iconv cause core dump</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/iconv-cause-core-dump/m-p/4283024#M671998</link>
      <description>How can i solve this problem?</description>
      <pubDate>Wed, 08 Oct 2008 09:17:49 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/iconv-cause-core-dump/m-p/4283024#M671998</guid>
      <dc:creator>yuyuguang</dc:creator>
      <dc:date>2008-10-08T09:17:49Z</dc:date>
    </item>
    <item>
      <title>Re: iconv cause core dump</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/iconv-cause-core-dump/m-p/4283025#M671999</link>
      <description>&amp;gt;In a simple program, it works fine.&lt;BR /&gt;&lt;BR /&gt;You neglected to mention you compiled with +DD64.  Doing this causes an abort.&lt;BR /&gt;&lt;BR /&gt;&amp;gt;char* str = " ???/PLASTIC SHEET (5M)";&lt;BR /&gt;&lt;BR /&gt;This code is illegal.  You need to quote the bogus trigraph:&lt;BR /&gt;char *str = " ??\?/PLASTIC SHEET (5M)";&lt;BR /&gt;&lt;BR /&gt;Using a real compiler with -z +DD64 +wlint  +w64bit you get these errors:&lt;BR /&gt;warning #4228-D: 64 bit migration: conversion from "int *" to a more strictly aligned type "size_t *" may cause misaligned access&lt;BR /&gt;     ret = iconv(c_pt, &amp;amp;sin, (size_t*)&amp;amp;in_len, &amp;amp;sout, (size_t*)&amp;amp;out_len);&lt;BR /&gt;warning #4228-D: 64 bit migration: conversion from "int *" to a more strictly aligned type "size_t *" may cause misaligned access&lt;BR /&gt;     ret = iconv(c_pt, &amp;amp;sin, (size_t*)&amp;amp;in_len, &amp;amp;sout, (size_t*)&amp;amp;out_len);&lt;BR /&gt;&lt;BR /&gt;This is your problem.  in_len and out_len must be size_t.&lt;BR /&gt;&lt;BR /&gt;&amp;gt;iconv(c_pt, NULL, NULL, NULL, NULL);&lt;BR /&gt;&lt;BR /&gt;You can't do this.  You get a signal 11.</description>
      <pubDate>Thu, 09 Oct 2008 04:47:08 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/iconv-cause-core-dump/m-p/4283025#M671999</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2008-10-09T04:47:08Z</dc:date>
    </item>
    <item>
      <title>Re: iconv cause core dump</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/iconv-cause-core-dump/m-p/4283026#M672000</link>
      <description>Hi Dennis Handly, you are right.&lt;BR /&gt;&lt;BR /&gt;see the output:&lt;BR /&gt;training:/cosys06/cosys/edi/test&amp;gt;make -f test_iconv.mk test_iconv&lt;BR /&gt;        /usr/ccs/bin/make -f /cosys06/cosys/edi/test/test_iconv.mk OBJS="test_iconv.o /cosys06/cosys/edi/src/interface/shared/edinutil.o /cosys06/cosys/edi/src/interface/shared/edutlog.o " EXE=/cosys06/cosys/edi/test/test_iconv build LIBHOME="/oradata/orabase/product/9.2.0/lib/" LIBXML="-L/usr/local/lib -lxml2 -lpthread -lm" PRODLIBHOME="/oradata/orabase/product/9.2.0/precomp/lib" CFLAGS="+DA2.0W +DS2.0    +DA2.0W +DS2.0 -DSS_64BIT_SERVER -I. -I/oradata/orabase/product/9.2.0/precomp/public -I/oradata/orabase/product/9.2.0/rdbms/public -I/oradata/orabase/product/9.2.0/rdbms/demo -I/oradata/orabase/product/9.2.0/plsql/public -I/oradata/orabase/product/9.2.0/network/public     " LFLAGS="+DA2.0W"&lt;BR /&gt;        cc +DA2.0W +DS2.0    +DA2.0W +DS2.0 -DSS_64BIT_SERVER -I. -I/oradata/orabase/product/9.2.0/precomp/public -I/oradata/orabase/product/9.2.0/rdbms/public -I/oradata/orabase/product/9.2.0/rdbms/demo -I/oradata/orabase/product/9.2.0/plsql/public -I/oradata/orabase/product/9.2.0/network/public      -I/cosys06/cosys/edi/src/shared/include/ -I/usr/local/include/libxml2/ -o test_iconv.o  -c test_iconv.c&lt;BR /&gt;        cc  +DA2.0W -o /cosys06/cosys/edi/test/test_iconv  test_iconv.o /cosys06/cosys/edi/src/interface/shared/edinutil.o /cosys06/cosys/edi/src/interface/shared/edutlog.o  -L/oradata/orabase/product/9.2.0/lib/ -lclntsh `cat /oradata/orabase/product/9.2.0/lib/ldflags`   `cat /oradata/orabase/product/9.2.0/lib/sysliblist`  -lm  -lpthread -lpthread -L/usr/local/lib -lxml2 -lpthread -lm&lt;BR /&gt;training:/cosys06/cosys/edi/test&amp;gt;./test_iconv&lt;BR /&gt;1&lt;BR /&gt;2&lt;BR /&gt;Bus error(coredump)&lt;BR /&gt;training:/cosys06/cosys/edi/test&amp;gt;gdb test_iconv core&lt;BR /&gt;Detected 64-bit executable.&lt;BR /&gt;Invoking /opt/langtools/bin/gdb64.&lt;BR /&gt;HP gdb 3.2 for PA-RISC 2.0 (wide), HP-UX 11.00.&lt;BR /&gt;Copyright 1986 - 2001 Free Software Foundation, Inc.&lt;BR /&gt;Hewlett-Packard Wildebeest 3.2 (based on GDB) is covered by the&lt;BR /&gt;GNU General Public License. Type "show copying" to see the conditions to&lt;BR /&gt;change it and/or distribute copies. Type "show warranty" for warranty/support.&lt;BR /&gt;..(no debugging symbols found)...&lt;BR /&gt;Core was generated by `test_iconv'.&lt;BR /&gt;Program terminated with signal 10, Bus error.&lt;BR /&gt;(no debugging symbols found)...&lt;BR /&gt;warning: The shared libraries were not privately mapped; setting a&lt;BR /&gt;breakpoint in a shared library will not work until you rerun the program.&lt;BR /&gt;&lt;BR /&gt;(no debugging symbols found)...(no debugging symbols found)...(no debugging symbols found)...&lt;BR /&gt;(no debugging symbols found)...(no debugging symbols found)...(no debugging symbols found)...(no debugging symbols found)...&lt;BR /&gt;(no debugging symbols found)...(no debugging symbols found)...&lt;BR /&gt;warning: section .data not found in /oradata/orabase/product/9.2.0/lib/libwtc9.sl&lt;BR /&gt;(no debugging symbols found)...(no debugging symbols found)...&lt;BR /&gt;#0  0xc00000000004d5f8 in _instantiate_iconv+0x58 () from /usr/lib/nls/iconv/pa20_64/methods.2/lhp15utf8.sl&lt;BR /&gt;(gdb) where&lt;BR /&gt;#0  0xc00000000004d5f8 in _instantiate_iconv+0x58 () from /usr/lib/nls/iconv/pa20_64/methods.2/lhp15utf8.sl&lt;BR /&gt;#1  0xc000000000315200 in iconv+0x30 () from /usr/lib/pa20_64/libc.2&lt;BR /&gt;#2  0x40000000000039f8 in Convert+0x100 ()&lt;BR /&gt;#3  0x4000000000003b5c in main+0x8c ()&lt;BR /&gt;(gdb) quit&lt;BR /&gt;training:/cosys06/cosys/edi/test&amp;gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;So, how can i solve this problem?</description>
      <pubDate>Thu, 09 Oct 2008 05:29:15 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/iconv-cause-core-dump/m-p/4283026#M672000</guid>
      <dc:creator>yuyuguang</dc:creator>
      <dc:date>2008-10-09T05:29:15Z</dc:date>
    </item>
    <item>
      <title>Re: iconv cause core dump</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/iconv-cause-core-dump/m-p/4283027#M672001</link>
      <description>&amp;gt;+DA2.0W&lt;BR /&gt;&lt;BR /&gt;Do not use this obsolete option.  Replace by +DD64.  Also add +M2 to help on 64 bit porting issues.&lt;BR /&gt;&lt;BR /&gt;&amp;gt;how can i solve this problem?&lt;BR /&gt;&lt;BR /&gt;Look at the warnings I mentioned.  I also told you:&lt;BR /&gt;  This is your problem. in_len and out_len MUST be size_t.</description>
      <pubDate>Thu, 09 Oct 2008 10:30:48 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/iconv-cause-core-dump/m-p/4283027#M672001</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2008-10-09T10:30:48Z</dc:date>
    </item>
    <item>
      <title>Re: iconv cause core dump</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/iconv-cause-core-dump/m-p/4283028#M672002</link>
      <description>Hi Dennis Handlyï¼ &lt;BR /&gt;&lt;BR /&gt;It is fine when i change the code&lt;BR /&gt;int ilen, olen;----&amp;gt;size_t ilen, olen;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;ilen = in_len;-----&amp;gt;ilen = (size_t)in_len;&lt;BR /&gt;olen = out_len;----&amp;gt;olen = (size_t)out_len;&lt;BR /&gt;&lt;BR /&gt;printf("2\n");&lt;BR /&gt;ret = iconv(c_pt, &amp;amp;sin, (size_t*)&amp;amp;in_len, &amp;amp;sout, (size_t*)&amp;amp;out_len);----&amp;gt;&lt;BR /&gt;ret = iconv(c_pt, &amp;amp;sin, &amp;amp;ilen, &amp;amp;sout, &amp;amp;olen);&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;But i casted to size_t in function iconv, why it core dump,&lt;BR /&gt;ret = iconv(c_pt, &amp;amp;sin, (size_t*)&amp;amp;in_len, &amp;amp;sout, (size_t*)&amp;amp;out_len);/*cast in iconv function*/&lt;BR /&gt;&lt;BR /&gt;I don'tknow why it core dump in this way.</description>
      <pubDate>Fri, 10 Oct 2008 01:01:41 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/iconv-cause-core-dump/m-p/4283028#M672002</guid>
      <dc:creator>yuyuguang</dc:creator>
      <dc:date>2008-10-10T01:01:41Z</dc:date>
    </item>
    <item>
      <title>Re: iconv cause core dump</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/iconv-cause-core-dump/m-p/4283029#M672003</link>
      <description>&amp;gt;But I cast to size_t in function iconv, why it core dump?&lt;BR /&gt;&lt;BR /&gt;Ah, a better question.&lt;BR /&gt;&lt;BR /&gt;This type of cast in C++ is called an reinterpret cast.  5.2.10(7) says the results of the cast are unspecified.  Your case also violates the alignment constraint since size_t is more strictly aligned than an int.&lt;BR /&gt;&lt;BR /&gt;So your case is illegal because it violates the Standard.  And for HP-UX it has these two problems:&lt;BR /&gt;1)  The alignment of an int is 4 but size_t is 8.  50% of the time you could be getting an alignment trap.&lt;BR /&gt;2)  iconv(3) thinks your data size is 8 bytes but you are passing in only 4.  So your sizes are your values multiplied by 4 G plus a random value from 0 to 4 Gb.</description>
      <pubDate>Fri, 10 Oct 2008 02:16:25 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/iconv-cause-core-dump/m-p/4283029#M672003</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2008-10-10T02:16:25Z</dc:date>
    </item>
  </channel>
</rss>

