[Bug libstdc++/55909] New: libtool test exposes what I think is some alignment issue in libstd++

philip.copeland at oracle dot com gcc-bugzilla@gcc.gnu.org
Tue Jan 8 17:05:00 GMT 2013


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

             Bug #: 55909
           Summary: libtool test exposes what I think is some alignment
                    issue in libstd++
    Classification: Unclassified
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: philip.copeland@oracle.com


Created attachment 29107
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=29107
Original libtool cpp file

While debugging libtool breakage on sparc64 (64bit Big Endian)

gcc-4.7.2-8.fc18.sparc64
glibc-2.16-28.fc18.sparc64

[mockbuild@localhost 104]$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/sparc64-redhat-linux/4.7.2/lto-wrapper
Target: sparc64-redhat-linux
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man
--infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla
--enable-bootstrap --enable-shared --enable-threads=posix
--enable-checking=release --disable-build-with-cxx
--disable-build-poststage1-with-cxx --with-system-zlib --enable-__cxa_atexit
--disable-libunwind-exceptions --enable-gnu-unique-object
--enable-linker-build-id --with-linker-hash-style=gnu
--enable-languages=c,c++,objc,obj-c++,java,fortran,lto --enable-plugin
--enable-initfini-array --enable-java-awt=gtk --disable-dssi
--with-java-home=/usr/lib/jvm/java-1.5.0-gcj-1.5.0.0/jre
--enable-libgcj-multifile --with-ecj-jar=/usr/share/java/eclipse-ecj.jar
--disable-libjava-multilib --with-ppl --with-cloog --with-long-double-128
--with-cpu=ultrasparc --disable-multilib --build=sparc64-redhat-linux
Thread model: posix
gcc version 4.7.2 20121109 (Red Hat 4.7.2-8) (GCC) 

-------------------------------------------------------------------------------

++ at_fn_check_prepare_dynamic 'if /builddir/build/BUILD/libtool-2.4.2/libtool
--mode=execute -dlopen m/module.la "./main" ; then :; else lt_status=0;        
    test "Xsparc64-redhat-linux-gnu" != "Xsparc64-redhat-linux-gnu" && test -x
"./main" && exit 77;         exit ; fi' exceptions.at:385
++ case $1 in
++ at_fn_check_prepare_trace exceptions.at:385
++ printf '%s\n' exceptions.at:385
++ at_check_trace=:
++ at_check_filter=:
++ :
++ :
++ at_status=139
++ at_failed=false
++ :
++ echo stderr:
stderr:
++ cat
/builddir/build/BUILD/libtool-2.4.2/tests/testsuite.dir/at-groups/104/stderr
++ :
++ /builddir/build/BUILD/libtool-2.4.2/libtool --mode=execute -dlopen
m/module.la ./main
exceptions_in_prog
/builddir/build/BUILD/libtool-2.4.2/tests/testsuite.dir/at-groups/104/test-source:
line 565: 61893 Segmentation fault      (core dumped) $LIBTOOL --mode=execute
-dlopen m/module.la "$lt_exe"
++ lt_status=139

------------------------------------------------------------------------------

This eventually boils down to
[mockbuild@localhost 104]$  /builddir/build/BUILD/libtool-2.4.2/libtool
--verbose --mode=execute -dlopen m/module.la ./.libs/lt-main
exceptions_in_prog
Segmentation fault (core dumped)


[mockbuild@localhost 104]$ gdb ./.libs/lt-main
(gdb) set environment LD_LIBRARY_PATH=m
(gdb) run
exceptions_in_prog

Program received signal SIGSEGV, Segmentation fault.
0xfffff8010061a558 in __frame_dummy_init_array_entry () from
/lib64/libstdc++.so.6
(gdb) where
#0  0xfffff8010061a558 in __frame_dummy_init_array_entry () from
/lib64/libstdc++.so.6
#1  0xfffff80100490988 in __cxxabiv1::__cxa_get_globals ()
    at ../../../../libstdc++-v3/libsupc++/eh_globals.cc:63
#2  0xfffff801004907cc in std::uncaught_exception ()
    at ../../../../libstdc++-v3/libsupc++/eh_catch.cc:136
#3  0xfffff801004ccbe4 in ~sentry (this=0x7fefffff1b0, __in_chrg=<optimized
out>)
    at
/usr/src/debug/gcc-4.7.2-20121109/obj-sparc64-redhat-linux/sparc64-redhat-linux/libstdc++-v3/include/ostream:429
#4  std::__ostream_insert<char, std::char_traits<char> > (__out=...,
__s=<optimized out>, 
    __n=<optimized out>)
    at
/usr/src/debug/gcc-4.7.2-20121109/obj-sparc64-redhat-linux/sparc64-redhat-linux/libstdc++-v3/include/bits/ostream_insert.h:112
#5  0x000000000010321c in operator<< <std::char_traits<char> > (
    __s=0x1085f8 "exceptions_in_prog\n", __out=...)
    at
/usr/lib/gcc/sparc64-redhat-linux/4.7.2/../../../../include/c++/4.7.2/ostream:533
#6  exceptions_in_prog () at main.cpp:30
#7  0x0000000000102e78 in main () at main.cpp:120

-------------------------------------------------------------------------------
Lets read that in order with some program text around it that might make some
better sense:

#7  0x0000000000102e78 in main () at main.cpp:120
(gdb) list
115     int main (void)
116     {
117
118       LTDL_SET_PRELOADED_SYMBOLS();
119
120       if (exceptions_in_prog ())
121         return 1;
122       if (exceptions_in_lib ())
123         return 1;
124       if (exceptions_in_module ())

#6  exceptions_in_prog () at main.cpp:30
(gdb) list
25        return 0;
26      }
27
28      int exceptions_in_prog (void)
29      {
30        std::cerr << "exceptions_in_prog\n";
31        try {
32          foo ();
33        }
34        catch (exc e) {

#5  0x000000000010321c in operator<< <std::char_traits<char> > (
    __s=0x1085f8 "exceptions_in_prog\n", __out=...)
    at
/usr/lib/gcc/sparc64-redhat-linux/4.7.2/../../../../include/c++/4.7.2/ostream:533
533             __ostream_insert(__out, __s,
(gdb) list
528         operator<<(basic_ostream<char, _Traits>& __out, const char* __s)
529         {
530           if (!__s)
531             __out.setstate(ios_base::badbit);
532           else
533             __ostream_insert(__out, __s,
534                             
static_cast<streamsize>(_Traits::length(__s)));
535           return __out;
536         }
537

(gdb) down
#4  std::__ostream_insert<char, std::char_traits<char> > (__out=...,
__s=<optimized out>,
    __n=<optimized out>)
    at
/usr/src/debug/gcc-4.7.2-20121109/obj-sparc64-redhat-linux/sparc64-redhat-linux/libstdc++-v3/include/bits/ostream_insert.h:112
112           return __out;
(gdb) list
107                   __throw_exception_again;
108                 }
109               __catch(...)
110                 { __out._M_setstate(__ios_base::badbit); }
111             }
112           return __out;
113         }
114
115       // Inhibit implicit instantiations for required instantiations,
116       // which are defined via explicit instantiations elsewhere.

#3  0xfffff801004ccbe4 in ~sentry (this=0x7fefffff1b0, __in_chrg=<optimized
out>)
    at
/usr/src/debug/gcc-4.7.2-20121109/obj-sparc64-redhat-linux/sparc64-redhat-linux/libstdc++-v3/include/ostream:429
429             if (bool(_M_os.flags() & ios_base::unitbuf) &&
!uncaught_exception())
(gdb) list
424            *  @c flush() on the output stream.
425           */
426           ~sentry()
427           {
428             // XXX MT
429             if (bool(_M_os.flags() & ios_base::unitbuf) &&
!uncaught_exception())
430               {
431                 // Can't call flush directly or else will get into
recursive lock.
432                 if (_M_os.rdbuf() && _M_os.rdbuf()->pubsync() == -1)
433                   _M_os.setstate(ios_base::badbit);

#2  0xfffff801004907cc in std::uncaught_exception ()
    at ../../../../libstdc++-v3/libsupc++/eh_catch.cc:136
136       __cxa_eh_globals *globals = __cxa_get_globals ();
(gdb) list
131
132
133     bool
134     std::uncaught_exception() throw()
135     {
136       __cxa_eh_globals *globals = __cxa_get_globals ();
137       return globals->uncaughtExceptions != 0;
138     }

#1  0xfffff80100490988 in __cxxabiv1::__cxa_get_globals ()
    at ../../../../libstdc++-v3/libsupc++/eh_globals.cc:63
63      { return get_global(); }
(gdb) list
58      __cxxabiv1::__cxa_get_globals_fast() _GLIBCXX_NOTHROW
59      { return get_global(); }
60
61      extern "C" __cxa_eh_globals*
62      __cxxabiv1::__cxa_get_globals() _GLIBCXX_NOTHROW
63      { return get_global(); }
64
65
66      #else
67

#0  0xfffff8010061a558 in __frame_dummy_init_array_entry () from
/lib64/libstdc++.so.6
(gdb) list
68      // Single-threaded fallback buffer.
69      static __cxa_eh_globals eh_globals;
70
71      #if __GTHREADS
72
73      static void
74      eh_globals_dtor(void* ptr)
75      {
76        if (ptr)
77          {

-------------------------------------------------------------------------------

I suspect this may be an endian/alignment bug as the same g++ program will run
correctly on an x86_64 system, however my c++ foo is somewhat weak when it
comes to the lower levels. The above is about as far as I can debug this.



More information about the Gcc-bugs mailing list