static linking of pthread crashes with segfault
Hi all, I tried to link a pthread application with -static and run into a segfault on x86, same on powerpc. I tried gcc 4.4.2 (linux/x86) and 4.0.2 for powerpc-unknown-linux-gnu For the x86 linux example I got in gdb: (gdb) bt #0 0x in ?? () #1 0x08094d49 in __cxa_guard_release () #2 0x08050fa1 in get_locale_mutex () at ../../../../libstdc++-v3/src/locale_init.cc:38 #3 0x0805326a in locale (this=0x81497dc) at ../../../../libstdc++-v3/src/locale_init.cc:211 #4 0x0804efc7 in basic_streambuf (this=0x8147260) at /home/krud/work/gcc-4.4.2/build_linux/i686-pc-linux-gnu/libstdc++-v3/include/streambuf:442 #5 stdio_sync_filebuf (this=0x8147260) at /home/krud/work/gcc-4.4.2/build_linux/i686-pc-linux-gnu/libstdc++-v3/include/ext/stdio_sync_filebuf.h:68 #6 Init (this=0x8147260) at ../../../../libstdc++-v3/src/ios_init.cc:85 #7 0x08048242 in global constructors keyed to a () #8 0x0810beed in __do_global_ctors_aux () #9 0x08048120 in _init () #10 0x080a8112 in __libc_csu_init () #11 0x080a7b73 in __libc_start_main () #12 0x08048151 in _start () at ../sysdeps/i386/elf/start.S:119 (gdb) The application runs with shared libs without any problems. g++ -static -O2 main.cpp /usr/lib/libpthread.a -o linux Any ideas? Thanks Klaus -- GRATIS für alle GMX-Mitglieder: Die maxdome Movie-FLAT! Jetzt freischalten unter http://portal.gmx.net/de/go/maxdome01
compile problems with gcc 4.5.0
Hi all, I tried to compile the gcc 4.5.0 version, but got errors with gmp :-( I did: k...@mauersegler:~/work/gcc-4.5.0$ cp -pr ../gmp-5.0.1/ ./gmp k...@mauersegler:~/work/gcc-4.5.0$ cp -pr ../mpfr-2.4.2/ ./mpfr k...@mauersegler:~/work/gcc-4.5.0$ cp -pr ../mpc-0.8.1/ ./mpc k...@mauersegler:~/work/gcc-4.5.0$ cp -pr ../ppl-0.10.2/ ./ppl k...@mauersegler:~/work/gcc-4.5.0$ mkdir build_linux k...@mauersegler:~/work/gcc-4.5.0$ cd build_linux/ k...@mauersegler:~/work/gcc-4.5.0/build_linux$ ../configure --prefix=/opt/linux --enable-languages=c,c++ And got: ... hecking whether fmal is declared... yes checking whether rintf is declared... yes checking whether rintl is declared... yes checking for int_fast16_t... yes checking for int_fast32_t... yes checking for int_fast64_t... yes checking for uint_fast16_t... yes checking for uint_fast32_t... yes checking for uint_fast64_t... yes checking for ld used by GCC... /opt/linux/lib/gcc/i686-pc-linux-gnu/4.4.2/../../../../i686-pc-linux-gnu/bin/ld checking if the linker (/opt/linux/lib/gcc/i686-pc-linux-gnu/4.4.2/../../../../i686-pc-linux-gnu/bin/ld) is GNU ld... yes checking for shared library run path origin... done checking how to link with libgmp... -lgmp checking how to link with libgmpxx... -lgmpxx -lgmp checking for the GMP library version 4.1.3 or above... no configure: error: Cannot find GMP version 4.1.3 or higher. GMP is the GNU Multi-Precision library: see http://www.swox.com/gmp/ for more information. When compiling the GMP library, do not forget to enable the C++ interface: add --enable-cxx to the configuration options. make[2]: *** [configure-stage1-ppl] Fehler 1 make[2]: Verlasse Verzeichnis '/home/krud/work/gcc-4.5.0/build_linux' make[1]: *** [stage1-bubble] Fehler 2 make[1]: Verlasse Verzeichnis '/home/krud/work/gcc-4.5.0/build_linux' make: *** [all] Fehler 2 I also copied gmp-4.3.1 to the gcc path but got the same results. How can I proceed here? Thanks Klaus -- GRATIS für alle GMX-Mitglieder: Die maxdome Movie-FLAT! Jetzt freischalten unter http://portal.gmx.net/de/go/maxdome01
-flto, remove unsued code from output
Hi all, I play a bit with lto optimisation. As I see, some functions will be inlined during link stage which is the expected result. But the function code which is always inlined is not removed from the output file which will result in larger output files. Any additional option to use with gcc during compile or link? I am using gcc-4.5.1 for avr target on linux-x86 host. Regards Klaus -- Neu: GMX De-Mail - Einfach wie E-Mail, sicher wie ein Brief! Jetzt De-Mail-Adresse reservieren: http://portal.gmx.net/de/go/demail
access to static data member fails with indirect ptr
Hi all, the following code fails with gcc 4.4.3,4.5.0 and 4.6 snapshot (some weeks old) : #include using namespace std; class A { public: static const int x=10; }; class Zgr_A { public: A* operator->() { return (A*)0; } }; template class Zgr { public: T* operator->() { return (T*)0; } }; int main() { A a_direct; A* a_ptr; Zgr_A a_indirect_ptr; Zgr a_template_ptr; A* ptr_from_indirect= a_indirect_ptr.operator->(); cout << "0. " << A::x << endl; cout << "1. " << a_direct.x << endl; cout << "2. " << a_ptr->x << endl; cout << "3. " << a_indirect_ptr->x << endl; cout << "4. " << a_template_ptr->x << endl; cout << "5. " << ptr_from_indirect->x << endl; cout << "6. " << a_template_ptr.operator->()->x << endl; cout << "7. " << ((A*)(a_template_ptr.operator->()))->x << endl; return 0; } Result: g++ -g main.cpp -o go /tmp/ccABoZtk.o: In function `main': main.cpp:37: undefined reference to `A::x' main.cpp:38: undefined reference to `A::x' main.cpp:40: undefined reference to `A::x' main.cpp:41: undefined reference to `A::x' collect2: ld returned 1 exit status Is my code wrong or is it a compiler bug? If the code is wrong, I expect a compiler error not a linker message! Wondering... Klaus P.S. Borland C++ compiles and links correct. -- Empfehlen Sie GMX DSL Ihren Freunden und Bekannten und wir belohnen Sie mit bis zu 50,- Euro! https://freundschaftswerbung.gmx.de
Re: access to static data member fails with indirect ptr
> > Is my code wrong > > Yes. You need to define A::x. Grrr... so stupid! :-) Yes, you are right. I stumbled that only a few lines generates an error. Yes, the compiler optimize them out if the access is direct. With -O3 it compiles and links without errors also without having const int A::x; Thanks for the hint. Regards! Klaus -- Empfehlen Sie GMX DSL Ihren Freunden und Bekannten und wir belohnen Sie mit bis zu 50,- Euro! https://freundschaftswerbung.gmx.de
Re: GCC 4.9.0 Status Report (2014-03-13)
I want to ask how I can find the bugs in bugzilla which are listed in the "Quality Data" Table. It feels that there are more bugs which are not listed. For example: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57694 Actually the compiler returns "not implemented" while compiling the given example code but it seems that this bug is not tracked in the actual quality data. my question is: Which is the selection criteria that a bug is related to the release. What is maybe the missing information in a bug report to add the bug to that list. Can I help by give some more example code or any other "simple" things to support the process a bit? Regards Klaus > Status > == > > The trunk is still in Stage 4, which means only patches fixing regressions > and documentation issues are appropriate. > > Comparing to last year's status reports, we are something in between a > fortnight and month behind the last year's schedule, but if enough attention > is given to the remaining P1 blockers, we could still release around the > beginning of April. > > The list of secondary architectures has changed recently, so to remind people > I'm including it here: > > The primary platforms are: > > arm-linux-gnueabi > i386-unknown-freebsd > i686-pc-linux-gnu > mipsisa64-elf > powerpc64-unknown-linux-gnu > sparc-sun-solaris2.10 > x86_64-unknown-linux-gnu > > The secondary platforms are: > > aarch64-elf > powerpc-ibm-aix7.1.0.0 > i686-apple-darwin > i686-pc-cygwin > i686-mingw32 > s390x-linux-gnu > > > Quality Data > > > Priority # Change from last report > --- --- > P19- 23 > P2 75- 12 > P3 15- 6 > --- --- > Total99- 41 > > > > Previous Report > === > > http://gcc.gnu.org/ml/gcc/2014-02/msg00013.html > > > The next report will be sent by me again, hopefully announcing > the first GCC 4.9.0 release candidate soon. >