Bug 33021 - memory allocation error of std::string if -fvisibility=hidden and -D_GLIBCXX_DEBUG both active
Summary: memory allocation error of std::string if -fvisibility=hidden and -D_GLIBCXX_...
Alias: None
Product: gcc
Classification: Unclassified
Component: libstdc++ (show other bugs)
Version: 4.1.1
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
Depends on:
Reported: 2007-08-08 06:56 UTC by Sky Lau
Modified: 2007-08-10 15:15 UTC (History)
2 users (show)

See Also:
Known to work: 4.2.0 4.2.1 4.3.0
Known to fail:
Last reconfirmed:


Note You need to log in before you can comment on or make changes to this bug.
Description Sky Lau 2007-08-08 06:56:44 UTC
OS: CentOS 5.0 x86_64
or Debian Sid (i386)

GCC Version:
gcc (GCC) 4.1.3 20070718 (prerelease) (Debian 4.1.2-14)
gcc (GCC) 4.1.1 20070105 (Red Hat 4.1.1-52)

Test Code (test.cpp) :
=============CODE STARTS HERE================
#include <string>
#include <sstream>

int main(int argc, char** argv)
    std::string abc = "hello world";
    std::istringstream buffer(abc);
    std::string str2;
    buffer >> str2;
    return 0;
=============CODE ENDS HERE================

Make command:
/usr/bin/gcc -o test test.cpp -lstdc++ -fvisibility=hidden -fvisibility-inlines-hidden -Wall -W -O0 -g -D_GLIBCXX_DEBUG
Comment 1 Andrew Pinski 2007-08-08 09:11:51 UTC
Can you try a later version of GCC as 4.1.x's libstdc++ did not have the fix for -fvisibility=hidden, see PR 19664 for more details (it was fixed for 4.2.0).
Comment 2 Sky Lau 2007-08-08 09:13:35 UTC
I have tried the code and it works for gcc 4.2. 
But I have to sticked at gcc 4.1.x for compatibility reason

Comment 3 Paolo Carlini 2007-08-08 09:18:07 UTC
I was about to reply the same as Andrew's... Mainline is also ok, by the way. I'm afraid this will end up being a WONTFIX in 4_1-branch because there are zero chances that those fixes will be backported to the branch...
Comment 4 Paolo Carlini 2007-08-10 15:15:10 UTC