[Bug libstdc++/109074] SIGABRT signal without using -lpthread at Linux RHEL 7.3
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109074 --- Comment #13 from Murugesan Nagarajan --- MY LAST COMMENT: I agree. Normally I used to handle bug fix using following ways: 1. Steps to reproduce to issue creating core dump files. There are some other ways which may work(Example: -pthread or -lmurugesanopenssl or -lrfcsdk or -lnwrfcsdk or ... options) After this I used to receive/send that test result to/from test/development team. Few libraries I faced a lot of errors during 2008 to 2013 and FEW of them(I guess 4 out of six) were fixed during. 2. Hence I reported this error at current(old version) library. I agree that it is working when we use -pthread. However, this may report some other issue in future.
[Bug libstdc++/109074] SIGABRT signal without using -lpthread at Linux RHEL 7.3
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109074 --- Comment #10 from Murugesan Nagarajan --- (In reply to Murugesan Nagarajan from comment #9) > Thank you again. Reason for Porting this comment: > Libc Library having core dump issue.hence thought of sharing this bug at > Libc Library. Hence sigabrt signal needs to be handler at libc.so.6 Library or this could have been fixed at other library. If so (like libc.so:))I need to know which version of that library fixed this issue. I'm not changing the status.
[Bug libstdc++/109074] SIGABRT signal without using -lpthread at Linux RHEL 7.3
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109074 --- Comment #9 from Murugesan Nagarajan --- Thank you again. Reason for Porting this comment: Libc Library having core dump issue.hence thought of sharing this bug at Libc Library.
[Bug libstdc++/109074] SIGABRT signal without using -lpthread at Linux RHEL 7.3
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109074 --- Comment #7 from Murugesan Nagarajan --- (In reply to Andrew Pinski from comment #3) > The reason for the abort is because you didn't catch the exception as > libstc++ is throwing one because threads are not enabled at runtime via the > linking of libpthread. Thank you again. Handled using try catch exception. However this exception not from my compilation issue. I feel that issue from libstdc++ library(older version) Updated code using try catch exception: /* * Creating thread using "class thread" at C++ * Sample C++ program using the "class thread". * Once an object is created, it used to create a thread. * When creating object, we need to pass the name of the function as parameter to that object. * Once creating the object, that function used to be called by the thread. * I will write mutex comments later. * Example: * thread t1(ThreadMethod); * Here t1 is creating the new thread. * I have not tested following code at other operating systems(UNIX/AIX/SunOS/HP-UX/...) excluding Linux, CYGWIN_NT and MINGW */ #include #if defined(LINUX) #include // syscall(SYS_gettid) #ifdef SYS_gettid #define gettid() ((pid_t)syscall(SYS_gettid)) #endif #elif defined(CYGWIN_NT) || defined (MINGW) #define gettid() (unsigned long)pthread_self() #endif #include #include #include using namespace std; int TotalThreadCount = 0; pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER; void ThreadMethod() { while(true) { if( 2 <= TotalThreadCount ) { break; } pthread_mutex_lock(&mutex); string DispTID = ""; DispTID = string("TotalThreadCount :") + to_string(TotalThreadCount) + " TID: " + to_string(gettid()) + "\n"; cout << DispTID; cout.flush(); sleep(1); ++TotalThreadCount; pthread_mutex_unlock(&mutex); } } int main() { // class thread available from C++11 // initialize the object using related thread function. try { thread t1(ThreadMethod); thread t2(ThreadMethod); t1.join(); t2.join(); } catch( std::exception &e) { cout << "Unable to create thread using class thread\n"; cout << "Caught thread exception: " << e.what() << "\n"; cout << "Re-compile your program using -lpthread\n"; } cout << "mutex.__data: " << (unsigned long long)&mutex.__data << "\n"; cout << "mutex.__data.__lock: " << (unsigned long long)&mutex.__data.__lock << "\n"; cout << "mutex.__data.__count: " << (unsigned long long)&mutex.__data.__count << "\n"; cout << "mutex.__data.__owner: " << (unsigned long long)&mutex.__data.__owner << "\n"; cout << "mutex.__data.__nusers: " << (unsigned long long)&mutex.__data.__nusers << "\n"; cout << "mutex.__data.__kind: " << (unsigned long long)&mutex.__data.__kind << "\n"; cout << "mutex.__data.__spins: " << (unsigned long long)&mutex.__data.__spins << "\n"; cout << "mutex.__data.__list: " << (unsigned long long)&mutex.__data.__list << "\n"; cout << "mutex.__data.__list.__prev: " << (unsigned long long)&mutex.__data.__list.__prev << "\n"; cout << "mutex.__data.__list.__next: " << (unsigned long long)&mutex.__data.__list.__next << "\n"; cout << "mutex.__size: " << (unsigned long long)&mutex.__size << "\n"; cout << "mutex.__align: " << (unsigned long long)&mutex.__align << "\n"; return 0; } /* pthread_mutex_t is a union having one struct one char array[40] and one long. union pthread_mutex_t { pthread_mutex_t::__pthread_mutex_s == double linked list { int __lock; == 04 bytes unsigned int __count; == 04 bytes int __owner;== 04 bytes unsigned int __nusers; == 04 bytes int __kind; == 04 bytes int __spins;== 04 bytes __pthread_list_t __list;== 16 bytes { *prev; *next; } } __data; == 40 bytes char __size[40];== 40 bytes long __align; == 08 bytes } == 40 bytes since this is union taking maximum bytes. Hence size of this union is 40 bytes. */ /* $ /usr/bin/g++ -DLINUX -g -Wall thread.cpp -o ./a.out -std=c++11 $ # Tested this code on padding no wastage of memory using mutex. Unable to create thread using class thread Caught thread excepti
[Bug libstdc++/109074] SIGABRT signal without using -lpthread at Linux RHEL 7.3
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109074 --- Comment #5 from Murugesan Nagarajan --- (In reply to Murugesan Nagarajan from comment #4) > Thank you for your comment. > I feel that there WAS a bug in old libc library. > I am not sure if current libc version having this bug or not. > - > 01. external library /lib64/libc.so.6 => /lib64/libc-2.17.so > $ /usr/bin/g++ -g -Wall libcversion.cpp -o ./a.out > $ ./a.out > GNU libc version: 2.17 > This should have been fixed in later versions of libc. > I need to know related libc version without this bug 109074. > - > 02. Bug related information from core file: > $ /usr/bin/g++ -DLINUX -g -Wall thread.cpp -o ./a.out -std=c++11 > $ gdb a.out > Reading symbols from /home/murugesan_openssl/a.out...done. > (gdb) run > Starting program: /home/murugesan_openssl/a.out > terminate called after throwing an instance of 'std::system_error' > what(): Enable multithreading to use std::thread: Operation not permitted > Program received signal SIGABRT, Aborted. > 0x772311d7 in raise () from /lib64/libc.so.6 > Missing separate debuginfos, use: debuginfo-install > glibc-2.17-157.el7.x86_64 libgcc-4.8.5-11.el7.x86_64 > libstdc++-4.8.5-11.el7.x86_64 > (gdb) where > #0 0x772311d7 in raise () from /lib64/libc.so.6 > #1 0x772328c8 in abort () from /lib64/libc.so.6 > #2 0x77b35ab5 in __gnu_cxx::__verbose_terminate_handler() () from > /lib64/libstdc++.so.6 > #3 0x77b33a26 in ?? () from /lib64/libstdc++.so.6 > #4 0x77b33a53 in std::terminate() () from /lib64/libstdc++.so.6 > #5 0x77b33c73 in __cxa_throw () from /lib64/libstdc++.so.6 > #6 0x77b8a4b9 in > std::thread::_M_start_thread(std::shared_ptr) () >from /lib64/libstdc++.so.6 > #7 0x004020d2 in std::thread::thread > (this=0x7fffdc90, > __f=@0x4017cd: {void (void)} 0x4017cd ) at > /usr/include/c++/4.8.2/thread:135 > #8 0x00401a89 in main () at thread.cpp:50 > (gdb) > - Actually I am from India. wait for my reply(if required) on next day.
[Bug libstdc++/109074] SIGABRT signal without using -lpthread at Linux RHEL 7.3
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109074 --- Comment #4 from Murugesan Nagarajan --- Thank you for your comment. I feel that there WAS a bug in old libc library. I am not sure if current libc version having this bug or not. - 01. external library /lib64/libc.so.6 => /lib64/libc-2.17.so $ /usr/bin/g++ -g -Wall libcversion.cpp -o ./a.out $ ./a.out GNU libc version: 2.17 This should have been fixed in later versions of libc. I need to know related libc version without this bug 109074. - 02. Bug related information from core file: $ /usr/bin/g++ -DLINUX -g -Wall thread.cpp -o ./a.out -std=c++11 $ gdb a.out Reading symbols from /home/murugesan_openssl/a.out...done. (gdb) run Starting program: /home/murugesan_openssl/a.out terminate called after throwing an instance of 'std::system_error' what(): Enable multithreading to use std::thread: Operation not permitted Program received signal SIGABRT, Aborted. 0x772311d7 in raise () from /lib64/libc.so.6 Missing separate debuginfos, use: debuginfo-install glibc-2.17-157.el7.x86_64 libgcc-4.8.5-11.el7.x86_64 libstdc++-4.8.5-11.el7.x86_64 (gdb) where #0 0x772311d7 in raise () from /lib64/libc.so.6 #1 0x772328c8 in abort () from /lib64/libc.so.6 #2 0x77b35ab5 in __gnu_cxx::__verbose_terminate_handler() () from /lib64/libstdc++.so.6 #3 0x77b33a26 in ?? () from /lib64/libstdc++.so.6 #4 0x77b33a53 in std::terminate() () from /lib64/libstdc++.so.6 #5 0x77b33c73 in __cxa_throw () from /lib64/libstdc++.so.6 #6 0x77b8a4b9 in std::thread::_M_start_thread(std::shared_ptr) () from /lib64/libstdc++.so.6 #7 0x004020d2 in std::thread::thread (this=0x7fffdc90, __f=@0x4017cd: {void (void)} 0x4017cd ) at /usr/include/c++/4.8.2/thread:135 #8 0x00401a89 in main () at thread.cpp:50 (gdb) -
[Bug c++/109074] New: SIGABRT signal without using -lpthread at Linux RHEL 7.3
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109074 Bug ID: 109074 Summary: SIGABRT signal without using -lpthread at Linux RHEL 7.3 Product: gcc Version: 4.8.5 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: murugesandins at gmail dot com Target Milestone: --- Hi G++ bugzilla, $ /usr/bin/g++ --version g++ (GCC) 4.8.5 20150623 (Red Hat 4.8.5-11) Copyright (C) 2015 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. $ /usr/bin/cat /etc/redhat-release Red Hat Enterprise Linux Server release 7.3 (Maipo) I don't have root access and sudo access. I tried following sample thread.cpp program: [code] /* * Creating thread using "class thread" at C++ * Sample C++ program using the "class thread". * Once an object is created, it used to create a thread. * When creating object, we need to pass the name of the function as parameter to that object. * Once creating the object, that function used to be called by the thread. * I will write mutex comments later. * Example: * thread t1(ThreadMethod); * Here t1 is creating the new thread. * I have not tested following code at other operating systems(UNIX/AIX/SunOS/HP-UX/...) excluding Linux, CYGWIN_NT and MINGW */ #include #if defined(LINUX) #include // syscall(SYS_gettid) #ifdef SYS_gettid #define gettid() ((pid_t)syscall(SYS_gettid)) #endif #elif defined(CYGWIN_NT) || defined (MINGW) #define gettid() (unsigned long)pthread_self() #endif #include #include #include using namespace std; int TotalThreadCount = 0; pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER; void ThreadMethod() { while(true) { if( 2 <= TotalThreadCount ) { break; } pthread_mutex_lock(&mutex); string DispTID = ""; DispTID = string("TotalThreadCount :") + to_string(TotalThreadCount) + " TID: " + to_string(gettid()) + "\n"; cout << DispTID; cout.flush(); sleep(1); ++TotalThreadCount; pthread_mutex_unlock(&mutex); } } int main() { // class thread available from C++11 // initialize the object using related thread function. thread t1(ThreadMethod); thread t2(ThreadMethod); t1.join(); t2.join(); // cout << "mutex.__data: " << (unsigned long long)&mutex.__data << "\n"; return 0; } /* pthread_mutex_t is a union having one struct one char array[40] and one long. union pthread_mutex_t { pthread_mutex_t::__pthread_mutex_s == double linked list { int __lock; == 04 bytes unsigned int __count; == 04 bytes int __owner;== 04 bytes unsigned int __nusers; == 04 bytes int __kind; == 04 bytes int __spins;== 04 bytes __pthread_list_t __list;== 16 bytes { *prev; *next; } } __data; == 40 bytes char __size[40];== 40 bytes long __align; == 08 bytes } == 40 bytes since this is union taking maximum bytes. Hence size of this union is 40 bytes. */ [/code] $ /usr/bin/g++ -DLINUX -g -Wall thread.cpp -o ./a.out -std=c++11 $ ./a.out terminate called after throwing an instance of 'std::system_error' what(): Enable multithreading to use std::thread: Operation not permitted Aborted (core dumped) $ gdb a.out core.27255 Reading symbols from ./a.out...done. [New LWP 27255] Core was generated by `./a.out'. Program terminated with signal 6, Aborted. #0 0x7f1125cdd1d7 in raise () from /lib64/libc.so.6 Missing separate debuginfos, use: debuginfo-install glibc-2.17-157.el7.x86_64 libgcc-4.8.5-11.el7.x86_64 libstdc++-4.8.5-11.el7.x86_64 (gdb) #0 0x7f1125cdd1d7 in raise () from /lib64/libc.so.6 #1 0x7f1125cde8c8 in abort () from /lib64/libc.so.6 #2 0x7f11265e1ab5 in __gnu_cxx::__verbose_terminate_handler() () from /lib64/libstdc++.so.6 #3 0x7f11265dfa26 in ?? () from /lib64/libstdc++.so.6 #4 0x7f11265dfa53 in std::terminate() () from /lib64/libstdc++.so.6 #5 0x7f11265dfc73 in __cxa_throw () from /lib64/libstdc++.so.6 #6 0x7f11266364b9 in std::thread::_M_start_thread(std::shared_ptr) () from /lib64/libstdc++.so.6 #7 0x004020d2 in std::thread::
[Bug libstdc++/94810] std::cout segmentation fault in __attribute__((constructor)) function
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94810 --- Comment #13 from Murugesan Nagarajan --- @Andrew, Thank you for updating current bug id: 94810 Old bug reported: On: Mon 27-Apr-2020 09:44:52 PM UTC Old Bug URL: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94810 Old Status: RESOLVED INVALID @Andrew's comment on 2023-02-03 07:47:43 PM UTC Related linked bug/url: https://gcc.gnu.org/git/gitweb.cgi?p=gcc.git;h=4e4e3ffd10f53e Updated bug on: Sun 06-Nov-2022 04:16:00 PM UTC Updated status: Bug fix completed using "__attribute__" and new bug using "__has_attribute".
[Bug libstdc++/94810] std::cout segmentation fault in __attribute__((constructor)) function
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94810 --- Comment #12 from Murugesan Nagarajan --- Thank you for sharing comment at: >> https://gcc.gnu.org/git/gitweb.cgi?p=gcc.git;h=4e4e3ffd10f53e Move stream initialization into compiled library I am facing my issue to have my proper environment: 01. My laptop has gone before 6 months(it was having RHEL and ubuntu) at vmplayer iso files. 02. Current acer system do not have any .iso files. 03. My working place not providing sudo access at Linux. I have verified at cygwin using g++.exe which is working fine. :) $ g++.exe --version 2>&1 | grep GCC g++ (GCC) 11.3.0 However I can verify your g++ related changes and I will update this page(in future) when I have related OS using relative admin privileges. Have a nice weekend.
[Bug libstdc++/94810] std::cout segmentation fault in __attribute__((constructor)) function
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94810 --- Comment #11 from Murugesan Nagarajan --- Hi Andrew, Thank you for your comment. I'll check this after 09:00 AM. Regards, N.Murugesan Google: murugesan openssl
[Bug libstdc++/94810] std::cout segmentation fault in __attribute__((constructor)) function
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94810 --- Comment #9 from Murugesan Nagarajan --- I'll update my comment today(Sat 04-Feb-2023 IST) after 09:00 AM IST. Right now I'm facing network issue due to travelling.