<?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: map&amp;lt;string,vector &amp;lt;string&amp;gt; &amp;gt; causing segmentation fault in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/map-lt-string-vector-lt-string-gt-gt-causing-segmentation-fault/m-p/3919912#M761679</link>
    <description>After I converted your small code fragment to a main, it worked fine.&lt;BR /&gt;&lt;BR /&gt;The throw in frame #7 is probably due to the fact that you have not compiled EVERYTHING with -mt.  You must make sure all of your objects, archives and shlibs are compiled with -mt.&lt;BR /&gt;&lt;BR /&gt;On IPF, you get a nice message indicating this.&lt;BR /&gt;&lt;BR /&gt;For PA, if you compile with +d, you'll get the exact location of the throw.  string:1003 just got through destroying the string.&lt;BR /&gt;&lt;BR /&gt;&amp;gt;-w&lt;BR /&gt;&lt;BR /&gt;You really should NOT be using -w.  Instead use +W### to suppress individual messages.&lt;BR /&gt;&lt;BR /&gt;You do know that if you have a map of a STL container, you are going to copy the WHOLE STL container into the map?  Using a pointer to an existing container would prevent the copy.  But you would have to know when to clean up the space.</description>
    <pubDate>Thu, 04 Jan 2007 07:48:19 GMT</pubDate>
    <dc:creator>Dennis Handly</dc:creator>
    <dc:date>2007-01-04T07:48:19Z</dc:date>
    <item>
      <title>map&lt;string,vector &lt;string&gt; &gt; causing segmentation fault</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/map-lt-string-vector-lt-string-gt-gt-causing-segmentation-fault/m-p/3919910#M761677</link>
      <description>I am building shared-library of below code which I am using in my sample main. test is class. &lt;BR /&gt;&lt;BR /&gt;void test::runMap()&lt;BR /&gt;{&lt;BR /&gt;&lt;BR /&gt;        using std::string;&lt;BR /&gt;        std::map&lt;STRING&gt; &amp;gt;*mymap;&lt;BR /&gt;        std::vector &lt;STRING&gt;myvec;&lt;BR /&gt;        mymap=new std::map&lt;STRING&gt; &amp;gt;;&lt;BR /&gt;        map&lt;STRING&gt; &amp;gt;::iterator it1;&lt;BR /&gt;        std::vector&lt;STRING&gt;::const_iterator i;&lt;BR /&gt;        myvec.push_back("First");&lt;BR /&gt;        myvec.push_back("Second");&lt;BR /&gt;&lt;BR /&gt;        string tmp("key1");&lt;BR /&gt;&lt;BR /&gt;      (*mymap)[tmp]=myvec;     //// SEG FAULT occurs here&lt;BR /&gt;&lt;BR /&gt;//      mymap-&amp;gt;insert( make_pair( tmp, myvec ) );   //////THIS WORKS with no Segmentation fault&lt;BR /&gt;        it1 = (*mymap).find(tmp);&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;        std::cout &amp;lt;&amp;lt; "Printing contents of vector of size : " &amp;lt;&amp;lt; myvec.size();&lt;BR /&gt;        for(i=myvec.begin(); i!=myvec.end(); ++i){&lt;BR /&gt;                std::cout&amp;lt;&amp;lt;(*i)&amp;lt;&amp;lt;:endl&amp;gt;&lt;/STRING&gt;        }&lt;BR /&gt;&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;I have the following problem in my code using std::map&lt;STRING&gt; &amp;gt;*mymap.. I am using HP-UX PA-RISC 32-bit B.11.11 m/c &amp;amp; aCC compiler with  -v -mt -AA -w +DAportable -Dvolatile="" +Z  -g for compile options &amp;amp; &lt;BR /&gt;aCC -v -AA +Z -mt -o for linker options.. &lt;BR /&gt;&lt;BR /&gt;During running,&lt;BR /&gt;The line (*mymap)[tmp]=myvec gives rise to segmentation fault problem (core dumped) which leads to terminate&amp;gt;abort.. This occurs for apparently no reason.. Also when I replace this with mymap-&amp;gt;insert( make_pair( tmp, myvec ) ); , the problem doesn't occur.. &lt;BR /&gt;&lt;BR /&gt;But I cannot replace  the former with the latter because of its known limitations &amp;amp; also since I will have to replace the major part of my modules &amp;amp; across translation units. But since the latter works (which in most cases is similar to former case), there doesn't seem any memory corruption happening which I have checked with gdb &amp;amp; stack trace..&lt;BR /&gt;&lt;BR /&gt;With std::map&amp;lt;:string&amp;gt; &amp;amp; other simple types, this error doesn't arise. It only occurs when the second element of map is some STL, like vector or may be set also. For this case, operator= is not working as desired.&lt;BR /&gt;&lt;BR /&gt;Is this a known issue in HP-UX. Is there any need of system STL libraries patch or OS or  compiler patch required. Also, this code has worked &amp;amp; run in Solaris, Windows &amp;amp; other  platforms, so why is it failing only in HP-UX.&lt;BR /&gt;&lt;BR /&gt;The stack trace which will will at the least show  what is the error is related to..:--&lt;BR /&gt;&lt;BR /&gt;#0  0xc02110d8 in kill+0x10 () from /usr/lib/libc.2&lt;BR /&gt;#1  0xc01a86c4 in raise+0x24 () from /usr/lib/libc.2&lt;BR /&gt;#2  0xc01eb49c in abort_C+0x15c () from /usr/lib/libc.2&lt;BR /&gt;#3  0xc01eb4f4 in abort+0x1c () from /usr/lib/libc.2&lt;BR /&gt;#4  0x86c48 in std::terminate+0x30 ()&lt;BR /&gt;#5  0x7ee5c in ThrowException+0x68 ()&lt;BR /&gt;#6  0x7f2dc in __throw__FPvT1+0xf0 ()&lt;BR /&gt;#7  0x3b014 in std::basic_string&lt;CHAR&gt;,std::allocator&lt;CHAR&gt;&amp;gt;::_C_unlink  (this=0x4001d388)&lt;BR /&gt;    at /opt/aCC/include_std/string:1003&lt;BR /&gt;#8  0x46408 in std::basic_string&lt;CHAR&gt;,std::allocator&lt;CHAR&gt;&amp;gt;::operator=  (this=0x4001d388,&lt;BR /&gt;    __str=@0x4001cc50) at /opt/aCC/include_std/string.cc:267&lt;BR /&gt;#9  0x44760 in std&amp;lt;:basic_string&amp;gt;,std::allocator&lt;CHAR&gt;&amp;gt; const *,std::basic_string&lt;CHAR&gt;,std::allocator&lt;CHAR&gt;&amp;gt; *&amp;gt;::copy  (__first=0x4001cc50, __last=0x4001cc5c, __result=0x4001d388)&lt;BR /&gt;    at /opt/aCC/include_std/algorithm:1979&lt;BR /&gt;#10 0x41e0c in std::vector&amp;lt;:basic_string&amp;gt;,std::allocator&lt;CHAR&gt;&amp;gt;,std::allocator&amp;lt;:basic_string&amp;gt;,std::allocator&lt;CHAR&gt;&amp;gt;&amp;gt;&amp;gt;::operator=  (this=0x4001c874, __x=@0x7f7f0b00)&lt;BR /&gt;    at /opt/aCC/include_std/vector.cc:88&lt;BR /&gt;#11 0x3fd64 in test::runMap (this=0x7f7f0a75) at test.cpp:27&lt;BR /&gt;#12 0x3b454 in main (argc=1, argv=0x7f7f08ec) at mymain.cpp:27&lt;BR /&gt;&lt;BR /&gt;Please provide suggestions which may resolve or may aid in tracking down the problem. In case any more clarifications about the code/platform etc, please write down.&lt;BR /&gt;&lt;/CHAR&gt;&lt;/CHAR&gt;&lt;/CHAR&gt;&lt;/CHAR&gt;&lt;/CHAR&gt;&lt;/CHAR&gt;&lt;/CHAR&gt;&lt;/CHAR&gt;&lt;/CHAR&gt;&lt;/STRING&gt;&lt;/STRING&gt;&lt;/STRING&gt;&lt;/STRING&gt;&lt;/STRING&gt;</description>
      <pubDate>Wed, 03 Jan 2007 00:44:20 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/map-lt-string-vector-lt-string-gt-gt-causing-segmentation-fault/m-p/3919910#M761677</guid>
      <dc:creator>Milind Kulkarni</dc:creator>
      <dc:date>2007-01-03T00:44:20Z</dc:date>
    </item>
    <item>
      <title>Re: map&lt;string,vector &lt;string&gt; &gt; causing segmentation fault</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/map-lt-string-vector-lt-string-gt-gt-causing-segmentation-fault/m-p/3919911#M761678</link>
      <description>Shalom,&lt;BR /&gt;&lt;BR /&gt;It never hurts to have a system fully patched in order to avoid this being a contributing factor to issues.&lt;BR /&gt;&lt;BR /&gt;There are a number of patches in the bi-annual patch set for HP-UX 11.11 and 11.23 that could impact this issue.&lt;BR /&gt;&lt;BR /&gt;Using a debugger also sounds like a good idea in this case.&lt;BR /&gt;&lt;BR /&gt;Good Luck, &lt;BR /&gt;&lt;BR /&gt;Have fun,&lt;BR /&gt;&lt;BR /&gt;Thanks for using ITRC.&lt;BR /&gt;&lt;BR /&gt;SEP</description>
      <pubDate>Wed, 03 Jan 2007 01:19:28 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/map-lt-string-vector-lt-string-gt-gt-causing-segmentation-fault/m-p/3919911#M761678</guid>
      <dc:creator>Steven E. Protter</dc:creator>
      <dc:date>2007-01-03T01:19:28Z</dc:date>
    </item>
    <item>
      <title>Re: map&lt;string,vector &lt;string&gt; &gt; causing segmentation fault</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/map-lt-string-vector-lt-string-gt-gt-causing-segmentation-fault/m-p/3919912#M761679</link>
      <description>After I converted your small code fragment to a main, it worked fine.&lt;BR /&gt;&lt;BR /&gt;The throw in frame #7 is probably due to the fact that you have not compiled EVERYTHING with -mt.  You must make sure all of your objects, archives and shlibs are compiled with -mt.&lt;BR /&gt;&lt;BR /&gt;On IPF, you get a nice message indicating this.&lt;BR /&gt;&lt;BR /&gt;For PA, if you compile with +d, you'll get the exact location of the throw.  string:1003 just got through destroying the string.&lt;BR /&gt;&lt;BR /&gt;&amp;gt;-w&lt;BR /&gt;&lt;BR /&gt;You really should NOT be using -w.  Instead use +W### to suppress individual messages.&lt;BR /&gt;&lt;BR /&gt;You do know that if you have a map of a STL container, you are going to copy the WHOLE STL container into the map?  Using a pointer to an existing container would prevent the copy.  But you would have to know when to clean up the space.</description>
      <pubDate>Thu, 04 Jan 2007 07:48:19 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/map-lt-string-vector-lt-string-gt-gt-causing-segmentation-fault/m-p/3919912#M761679</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2007-01-04T07:48:19Z</dc:date>
    </item>
    <item>
      <title>Re: map&lt;string,vector &lt;string&gt; &gt; causing segmentation fault</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/map-lt-string-vector-lt-string-gt-gt-causing-segmentation-fault/m-p/3919913#M761680</link>
      <description>It appears SEP was correct after all.  I looked at your test case in CXX-DEV and it appears you need to go to A.03.39, PHSS_27942.  Since the latest version is A.03.73, you should go there instead.  You will have to get the base release, A.03.37 or A.03.70 from the application CD.  In CXX-DEV you said your versions is A.03.30.  This is obsolete and not supported.&lt;BR /&gt;&lt;A href="http://h21007.www2.hp.com/dspp/tech/tech_TechSoftwareDetailPage_IDX/1,1703,1743,00.html#11.11" target="_blank"&gt;http://h21007.www2.hp.com/dspp/tech/tech_TechSoftwareDetailPage_IDX/1,1703,1743,00.html#11.11&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;Note I get signal 11 instead of the throw.</description>
      <pubDate>Tue, 09 Jan 2007 05:50:32 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/map-lt-string-vector-lt-string-gt-gt-causing-segmentation-fault/m-p/3919913#M761680</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2007-01-09T05:50:32Z</dc:date>
    </item>
    <item>
      <title>Re: map&lt;string,vector &lt;string&gt; &gt; causing segmentation fault</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/map-lt-string-vector-lt-string-gt-gt-causing-segmentation-fault/m-p/3919914#M761681</link>
      <description>I tried with A.03.39 aCC verion, &amp;amp; it worked w/o any problem.</description>
      <pubDate>Tue, 09 Jan 2007 23:33:38 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/map-lt-string-vector-lt-string-gt-gt-causing-segmentation-fault/m-p/3919914#M761681</guid>
      <dc:creator>Milind Kulkarni</dc:creator>
      <dc:date>2007-01-09T23:33:38Z</dc:date>
    </item>
  </channel>
</rss>

