public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/43005]  New: Segmentation fault(not always) while running binary which has gcc and g++ compiled shared object files
@ 2010-02-09  5:48 sarveshwarac at india dot tejasnetworks dot com
  2010-02-09  9:46 ` [Bug libstdc++/43005] " paolo dot carlini at oracle dot com
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: sarveshwarac at india dot tejasnetworks dot com @ 2010-02-09  5:48 UTC (permalink / raw)
  To: gcc-bugs

compiler version: gcc 4.0.0, g++ 4.0.0
Reading specs from /usr/bin/../lib/gcc/powerpc-linux/4.0.0/specs
Target: powerpc-linux
Configured with:
/opt/eldk/build/ppc-2007-01-19/work/usr/src/denx/BUILD/crosstool-0.35/build/gcc-4.0.0-glibc-2.3.5-eldk/powerpc-linux/gcc-4.0.0/configure
--target=powerpc-linux --host=i686-host_pc-linux-gnu
--prefix=/var/tmp/eldk.HzYZNd/usr/crosstool/gcc-4.0.0-glibc-2.3.5-eldk/powerpc-linux
--with-headers=/var/tmp/eldk.HzYZNd/usr/crosstool/gcc-4.0.0-glibc-2.3.5-eldk/powerpc-linux/powerpc-linux/include
--with-local-prefix=/var/tmp/eldk.HzYZNd/usr/crosstool/gcc-4.0.0-glibc-2.3.5-eldk/powerpc-linux/powerpc-linux
--disable-nls --enable-threads=posix --enable-symvers=gnu
--enable-languages=c,c++ --enable-shared --enable-c99 --enable-long-long
--enable-__cxa_atexit

Linux version used on target is 2.6.26.

I have two shared object files gcc compiled fpp.so and g++ compiled fcc.so.
fcc.so is only one file with following code:

fccMain.cpp:
-----------

#include<iostream>
int main()
{
    cout << "Starting fcc.d" <<endl;
    return 0;

}

fpp.so has lot of c code.

The above two .so's linked with the following command.

/usr/bin/6xx-gcc -Wl,-M,-Map,fz.d.map,--cref -o fz.d -lpthread libfcc.so
libfpp.so

When running the executable(fz.d) on target, once in a while giving
segmentation
fault before the main.

gdb stack dump is given below:
------------------------------
Program received signal SIGSEGV, Segmentation fault.
0x0e03f084 in free () from /lib/libc.so.6
(gdb) where
#0  0x0e03f084 in free () from /lib/libc.so.6
#1  0x0df0a70c in std::ctype<char>::ctype () from /usr/lib/libstdc++.so.6
#2  0x0df1006c in std::locale::_Impl::_Impl () from /usr/lib/libstdc++.so.6
#3  0x0df1097c in std::locale::_Impl::_Impl () from /usr/lib/libstdc++.so.6
#4  0x0df0a70c in std::ctype<char>::ctype () from /usr/lib/libstdc++.so.6
#5  0x0e106370 in _IO_2_1_stdin_ () from /lib/libc.so.6
#6  0x0df0a70c in std::ctype<char>::ctype () from /usr/lib/libstdc++.so.6
#7  0x0df10c5c in std::locale::locale () from /usr/lib/libstdc++.so.6
#8  0x0df0e104 in std::ios_base::Init::Init () from /usr/lib/libstdc++.so.6
#9  0x0ffabaa8 in __static_initialization_and_destruction_0 () from
/etc/libfcc.so
#10 0x0ffabaf8 in global constructors keyed to main () from /etc/libfcc.so
#11 0x0ffabd34 in __do_global_ctors_aux () from /etc/libfcc.so
#12 0x0df0a70c in std::ctype<char>::ctype () from /usr/lib/libstdc++.so.6
#13 0xbfa15ddc in ?? ()
#14 0x0df0a70c in std::ctype<char>::ctype () from /usr/lib/libstdc++.so.6
#15 0x4800beb4 in _dl_rtld_di_serinfo () from /lib/ld.so.1
#16 0x48010740 in realloc () from /lib/ld.so.1
Previous frame inner to this frame (corrupt stack?)

If i remove the #include<iostream> line(fccMain.cpp) and replace it with either
<istream> and <ostream> or with <stdio.h>(printf in place of cout) it is always
working without any issue. Global data initialization from libfpp.so is looks
happening properly. But libfcc.so global data initialization is failing some
times in iostream, while initializing static ios_base::Init __ioinit.

I already tried by enabling -fpic, but still the problem is seen. Is it a bug
in gcc/g++(4.0.0) ? 


-Sarveshwara Chary.


-- 
           Summary: Segmentation fault(not always) while running binary
                    which has gcc and g++ compiled shared object files
           Product: gcc
           Version: 4.0.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: sarveshwarac at india dot tejasnetworks dot com


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


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug libstdc++/43005] Segmentation fault(not always) while running binary which has gcc and g++ compiled shared object files
  2010-02-09  5:48 [Bug libstdc++/43005] New: Segmentation fault(not always) while running binary which has gcc and g++ compiled shared object files sarveshwarac at india dot tejasnetworks dot com
@ 2010-02-09  9:46 ` paolo dot carlini at oracle dot com
  2010-02-09 10:49 ` jwakely dot gcc at gmail dot com
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: paolo dot carlini at oracle dot com @ 2010-02-09  9:46 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from paolo dot carlini at oracle dot com  2010-02-09 09:45 -------
Before anything else, you should try a current compiler, because 4.0.x isn't
maintained anymore, thus either 4.3.x or, better, 4.4.x. Then, if you are still
seeing something strange, we need a complete self-contained (and minimal)
reproducer. Thanks.


-- 

paolo dot carlini at oracle dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|sarveshwarac at india dot   |
                   |tejasnetworks dot com       |
             Status|UNCONFIRMED                 |WAITING
            Summary|Segmentation fault(not      |Segmentation fault(not
                   |always) while running binary|always) while running binary
                   |which has gcc and g++       |which has gcc and g++
                   |compiled shared object files|compiled shared object files


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


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug libstdc++/43005] Segmentation fault(not always) while running binary which has gcc and g++ compiled shared object files
  2010-02-09  5:48 [Bug libstdc++/43005] New: Segmentation fault(not always) while running binary which has gcc and g++ compiled shared object files sarveshwarac at india dot tejasnetworks dot com
  2010-02-09  9:46 ` [Bug libstdc++/43005] " paolo dot carlini at oracle dot com
@ 2010-02-09 10:49 ` jwakely dot gcc at gmail dot com
  2010-02-09 13:46 ` sarveshwarac at india dot tejasnetworks dot com
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: jwakely dot gcc at gmail dot com @ 2010-02-09 10:49 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from jwakely dot gcc at gmail dot com  2010-02-09 10:49 -------
In addition to what Paolo said:

You're using -lpthread, did you also use the relevant preprocessor options? For
powerpc -pthread does everything you need.

That code doesn't qualify the names from namespace std, so I don't see how it
even compiles.


-- 


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


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug libstdc++/43005] Segmentation fault(not always) while running binary which has gcc and g++ compiled shared object files
  2010-02-09  5:48 [Bug libstdc++/43005] New: Segmentation fault(not always) while running binary which has gcc and g++ compiled shared object files sarveshwarac at india dot tejasnetworks dot com
  2010-02-09  9:46 ` [Bug libstdc++/43005] " paolo dot carlini at oracle dot com
  2010-02-09 10:49 ` jwakely dot gcc at gmail dot com
@ 2010-02-09 13:46 ` sarveshwarac at india dot tejasnetworks dot com
  2010-02-09 13:52 ` paolo dot carlini at oracle dot com
  2010-02-11 23:52 ` paolo dot carlini at oracle dot com
  4 siblings, 0 replies; 6+ messages in thread
From: sarveshwarac at india dot tejasnetworks dot com @ 2010-02-09 13:46 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from sarveshwarac at india dot tejasnetworks dot com  2010-02-09 13:46 -------
I have used the following preprocessor options: -DTHREADED, -D_REENTRANT.
I tried with -pthread instead of -lpthread, but still the problem is seen.
using namespace std(;) line is present in my fccMain.cpp file after
#include<iostream>.

There is no any c++ code in libfpp.so. I kept some xx_init(constructor) &
xx_fini(destructor) functions across libfpp.so and libfcc.so files. I have also
changed the linking order of .so's and tried with gcc and g++ linkers.
Global/Static data initialization from libfpp.so is happening fine. But
libfcc.so static data initialization is failing in ios_base::init::init(from
iostream) function with the mentioned stack trace.


-- 


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


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug libstdc++/43005] Segmentation fault(not always) while running binary which has gcc and g++ compiled shared object files
  2010-02-09  5:48 [Bug libstdc++/43005] New: Segmentation fault(not always) while running binary which has gcc and g++ compiled shared object files sarveshwarac at india dot tejasnetworks dot com
                   ` (2 preceding siblings ...)
  2010-02-09 13:46 ` sarveshwarac at india dot tejasnetworks dot com
@ 2010-02-09 13:52 ` paolo dot carlini at oracle dot com
  2010-02-11 23:52 ` paolo dot carlini at oracle dot com
  4 siblings, 0 replies; 6+ messages in thread
From: paolo dot carlini at oracle dot com @ 2010-02-09 13:52 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from paolo dot carlini at oracle dot com  2010-02-09 13:51 -------
Nonetheless, please try with a maintained compiler and, in case, please provide
a complete self-contained reproducer, otherwise no action will be possible,
this bug will be closed for lack of feedback.


-- 


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


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug libstdc++/43005] Segmentation fault(not always) while running binary which has gcc and g++ compiled shared object files
  2010-02-09  5:48 [Bug libstdc++/43005] New: Segmentation fault(not always) while running binary which has gcc and g++ compiled shared object files sarveshwarac at india dot tejasnetworks dot com
                   ` (3 preceding siblings ...)
  2010-02-09 13:52 ` paolo dot carlini at oracle dot com
@ 2010-02-11 23:52 ` paolo dot carlini at oracle dot com
  4 siblings, 0 replies; 6+ messages in thread
From: paolo dot carlini at oracle dot com @ 2010-02-11 23:52 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from paolo dot carlini at oracle dot com  2010-02-11 23:52 -------
Feedback not forthcoming. If you have a self-contained reproducer for gcc4.4.x,
please re-open, thanks.


-- 

paolo dot carlini at oracle dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|WAITING                     |RESOLVED
         Resolution|                            |INVALID


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


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2010-02-11 23:52 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-02-09  5:48 [Bug libstdc++/43005] New: Segmentation fault(not always) while running binary which has gcc and g++ compiled shared object files sarveshwarac at india dot tejasnetworks dot com
2010-02-09  9:46 ` [Bug libstdc++/43005] " paolo dot carlini at oracle dot com
2010-02-09 10:49 ` jwakely dot gcc at gmail dot com
2010-02-09 13:46 ` sarveshwarac at india dot tejasnetworks dot com
2010-02-09 13:52 ` paolo dot carlini at oracle dot com
2010-02-11 23:52 ` paolo dot carlini at oracle dot com

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).