public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "gregoryk at edifecs dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug libstdc++/31368] basic_string and unsigned short leads to memory fault
Date: Tue, 27 Mar 2007 17:39:00 -0000	[thread overview]
Message-ID: <20070327173941.24367.qmail@sourceware.org> (raw)
In-Reply-To: <bug-31368-14317@http.gcc.gnu.org/bugzilla/>



------- Comment #10 from gregoryk at edifecs dot com  2007-03-27 18:39 -------
Got it, thanks. In may original test I was relaying on LD_LIBRARY_PATH to have
current folder in the values. And there was no checking of dlopen result for
simplicity. Here is updated code. It will search for libloader.so in current
folder.

#include <dlfcn.h>
#include <string>
#include "loader.h"

typedef void *pfLoader(std::ustring&);

int main(int argc, char* argv[])
{
        void * libHandle = dlopen("./libloader.so", RTLD_NOW|RTLD_GLOBAL);

        if (0 == libHandle)
        {
                printf("Can not load \"./libloader.so\".\n");
                return 1;
        }

        pfLoader* pF = (pfLoader*)dlsym(libHandle, "read_string");

        if (0 == pF)
        {
                printf("Can not find function \"read_string\" in
libloader.so\n");
                return 2;
        }

        std::ustring s;
//      s.reserve(1);   // uncomment this line to prevent abort
        pF(s);
        return 0;
}


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31368


  parent reply	other threads:[~2007-03-27 17:39 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-03-26 20:51 [Bug libstdc++/31368] New: " gregoryk at edifecs dot com
2007-03-26 21:11 ` [Bug libstdc++/31368] " pcarlini at suse dot de
2007-03-26 21:28 ` gregoryk at edifecs dot com
2007-03-26 21:52 ` pcarlini at suse dot de
2007-03-26 22:14 ` gregoryk at edifecs dot com
2007-03-26 22:25 ` pcarlini at suse dot de
2007-03-27 17:07 ` pcarlini at suse dot de
2007-03-27 17:20 ` gregoryk at edifecs dot com
2007-03-27 17:24 ` pcarlini at suse dot de
2007-03-27 17:37 ` pcarlini at suse dot de
2007-03-27 17:39 ` gregoryk at edifecs dot com [this message]
2007-03-27 17:40 ` gregoryk at edifecs dot com
2007-03-27 18:22 ` pcarlini at suse dot de
2007-03-27 18:25 ` pcarlini at suse dot de
2007-03-27 18:25 ` pcarlini at suse dot de
2007-03-27 18:51 ` gregoryk at edifecs dot com
2007-03-27 18:53 ` pcarlini at suse dot de

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20070327173941.24367.qmail@sourceware.org \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).