From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 116347 invoked by alias); 19 Mar 2019 21:31:20 -0000 Mailing-List: contact gcc-help-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-help-owner@gcc.gnu.org Received: (qmail 116337 invoked by uid 89); 19 Mar 2019 21:31:20 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 spammy= X-HELO: mail-wr1-f43.google.com Received: from mail-wr1-f43.google.com (HELO mail-wr1-f43.google.com) (209.85.221.43) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 19 Mar 2019 21:31:18 +0000 Received: by mail-wr1-f43.google.com with SMTP id q1so505013wrp.0 for ; Tue, 19 Mar 2019 14:31:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=jguk-org.20150623.gappssmtp.com; s=20150623; h=from:subject:to:message-id:date:user-agent:mime-version :content-language; bh=jr/9plhdt0LRWPr0MW5OcLzcq51ajFJnkxSXpkNG/Ao=; b=BHDodH0rAN5bbEBGP14Tl4OSqnVF8flemizX2PIbgWwDC8ooFiIYnszpIrbxX01KpA g+0t+is7xY1tzfyab+lVZ3/4NiHWwI7CXR85IP9NgYz4HD5jBQ4a3bjXrKO+IfPu4zZZ qbwp6DBXUp7Z9L4ZfXniFIeM2WzsQbWzyh4b4jBXgAaZsolQc/x6bVRrCmdVYmwv0K5o yL7AtmQ4ucHBMgwQ9lOFVC2CLu1RFxTLqbCXlzUDWYkeH+sTBsClZ7dwLaiEux9Oewd/ NDOG0e6jNSLhCqzanK8hvVVdlt2gX/Xi5bfm9/ze9fpWZGJIgtyrAdara4di1lOKHo5V e4Xw== Return-Path: Received: from [192.168.1.71] (251.98.189.80.dyn.plus.net. [80.189.98.251]) by smtp.gmail.com with ESMTPSA id y140sm559529wmd.18.2019.03.19.14.31.13 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 19 Mar 2019 14:31:13 -0700 (PDT) From: Jonny Grant Subject: Recursive SIGSEGV question To: gcc-help Message-ID: <1255ee27-882f-ab4e-ea45-ba6f35791b45@jguk.org> Date: Tue, 19 Mar 2019 22:05:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.5.1 MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="------------3B93E5597F4F60E113393DAD" X-SW-Source: 2019-03/txt/msg00118.txt.bz2 This is a multi-part message in MIME format. --------------3B93E5597F4F60E113393DAD Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-length: 3816 Hello Wanted to ask opinion about the following. Compiling with g++ 8.2.0 and saw the following. The program was in a recursive function call (bug). My test case is attached, although could not reproduce exactly same backtrace. I had a look at https://github.com/lattera/glibc/blob/master/malloc/malloc.c Is there an issue in _int_malloc? or was it most likely just out of memory? Do out of memory issues normally show up as SIGSEGV? I had expected some sort of "out of memory" This is the log from own software (not attached) :- Program terminated with signal SIGSEGV, Segmentation fault. #0 0x00007faa0e37b30e in _int_malloc (av=av@entry=0x7fa980000020, bytes=bytes@entry=45) at malloc.c:3557 3557 malloc.c: No such file or directory. [Current thread is 1 (Thread 0x7fa997860700 (LWP 20571))] (gdb) bt #0 0x00007faa0e37b30e in _int_malloc (av=av@entry=0x7fa980000020, bytes=bytes@entry=45) at malloc.c:3557 #1 0x00007faa0e37e2ed in __GI___libc_malloc (bytes=45) at malloc.c:3065 #2 0x00007faa0eba21a8 in operator new(unsigned long) () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6 I tried to create a test case, but got slightly different messages, they actually vary. Is there a gdb bug if the same program has different backtraces? GNU gdb (Ubuntu 8.1-0ubuntu3) 8.1.0.20180409-git Core was generated by `./loop'. Program terminated with signal SIGSEGV, Segmentation fault. #0 0x00007fc10dee51e7 in void std::__cxx11::basic_string, std::allocator >::_M_construct(char*, char*, std::forward_iterator_tag) () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (gdb) bt #0 0x00007fc10dee51e7 in void std::__cxx11::basic_string, std::allocator >::_M_construct(char*, char*, std::forward_iterator_tag) () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6 #1 0x00005592fbb669d7 in func (f="a", g=0) at loop.cpp:7 #2 0x00005592fbb669e8 in func (f="a", g=0) at loop.cpp:7 #3 0x00005592fbb669e8 in func (f="a", g=0) at loop.cpp:7 The backtrace seems to vary, is this possibly a GDB bug? Core was generated by `./loop'. Program terminated with signal SIGSEGV, Segmentation fault. #0 0x00005615cc3549ae in func ( f=, g=) at loop.cpp:6 6 { (gdb) bt #0 0x00005615cc3549ae in func ( f=, g=) at loop.cpp:6 #1 0x00005615cc354a03 in func (f="a", g=0) at loop.cpp:7 #2 0x00005615cc354a03 in func (f="a", g=0) at loop.cpp:7 #3 0x00005615cc354a03 in func (f="a", g=0) at loop.cpp:7 #4 0x00005615cc354a03 in func (f="a", g=0) at loop.cpp:7 Core was generated by `./loop'. Program terminated with signal SIGSEGV, Segmentation fault. #0 0x0000559924c939ae in func ( f=, g=) at loop.cpp:6 6 { (gdb) bt #0 0x0000559924c939ae in func ( f=, g=) at loop.cpp:6 #1 0x0000559924c93a03 in func (f="a", g=0) at loop.cpp:7 #2 0x0000559924c93a03 in func (f="a", g=0) at loop.cpp:7 #3 0x0000559924c93a03 in func (f="a", g=0) at loop.cpp:7 #4 0x0000559924c93a03 in func (f="a", g=0) at loop.cpp:7 #5 0x0000559924c93a03 in func (f="a", g=0) at loop.cpp:7 #6 0x0000559924c93a03 in func (f="a", g=0) at loop.cpp:7 #7 0x0000559924c93a03 in func (f="a", g=0) at loop.cpp:7 Jonny --------------3B93E5597F4F60E113393DAD Content-Type: text/x-c++src; name="loop.cpp" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="loop.cpp" Content-length: 189 // g++-8 -g -ggdb -O0 -Wall -Wextra -o loop loop.cpp #include static void func(std::string f, int g) { func(f.c_str(), g); } int main() { func("a", 0); return 0; } --------------3B93E5597F4F60E113393DAD--