简体   繁体   中英

Crash in std::locale::operator=(std::locale const&) on AIX

I am a bit new to AIX and stuck up with a weird issue. I have two AIX machine and my C++ application is running on one and crashing on the other.

When I checked packages installed (rpm -qa), I observed one difference, for 1st machine all the rpm's are ending with .ppc extension and for 2nd it's not. My cpp app is perfectly running on 2nd machine.

I suspect this can be a cause for this issue but not sure.

PS: Showing the difference between two. 两者之间的区别

Stack Trace:

    Program terminated with signal SIGSEGV, Segmentation fault.
#0  0xd0bded2c in std::locale::operator=(std::locale const&) () from /opt/freeware/lib/libstdc++.a(libstdc++.so.6)
(gdb) bt
#0  0xd0bded2c in std::locale::operator=(std::locale const&) () from /opt/freeware/lib/libstdc++.a(libstdc++.so.6)
#1  0xd0bdeee0 in std::ios_base::_M_init() () from /opt/freeware/lib/libstdc++.a(libstdc++.so.6)
#2  0xd0bdede4 in std::basic_ios<char, std::char_traits<char> >::init () from /opt/freeware/lib/libstdc++.a(libstdc++.so.6)
#3  0x100b618c in Logging::Logging (this=0x20086438, filename=..., level=4) at Logging.cpp:404
#4  0x1005d96c in main (argc=<error reading variable>, argv=<error reading variable>) at  _start_ :141
warning: (Internal error: pc 0x100001e3 in read in psymtab, but not in symtab.)

warning: (Internal error: pc 0x100001e4 in read in psymtab, but not in symtab.)

Code Snapshot:

string logFile = "test.txt"
Logging* logger = new Logging(logFile,4);

// Logging Constructor     
Logging::Logging(const string &filename,loglevel): logfilename(filename),level(loglevel) {
}

I just faced the same issue and was able to fix so by disabling optimization flags (like -O2) at makefile for the g++ compiler. My makefile contained

CC = g++ CC_FLAGS = -g3 -ggdb -Wall -std=c++11 -DDEBUG -pthread -O2

Where the backtrace from gdb shown std::locale::operator=(std::locale const&) ()

This wasn't occouring anymore without flags "-O2"

CC = g++ CC_FLAGS = -Wall -std=c++11 -DDEBUG -pthread

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM