From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28550 invoked by alias); 24 Jun 2010 18:10:03 -0000 Received: (qmail 28541 invoked by uid 22791); 24 Jun 2010 18:10:02 -0000 X-SWARE-Spam-Status: No, hits=-1.6 required=5.0 tests=AWL,BAYES_00,MSGID_FROM_MTA_HEADER,TW_CX,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mtagate6.de.ibm.com (HELO mtagate6.de.ibm.com) (195.212.17.166) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 24 Jun 2010 18:09:58 +0000 Received: from d12nrmr1607.megacenter.de.ibm.com (d12nrmr1607.megacenter.de.ibm.com [9.149.167.49]) by mtagate6.de.ibm.com (8.13.1/8.13.1) with ESMTP id o5OI9tPC019338 for ; Thu, 24 Jun 2010 18:09:55 GMT Received: from d12av02.megacenter.de.ibm.com (d12av02.megacenter.de.ibm.com [9.149.165.228]) by d12nrmr1607.megacenter.de.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id o5OI9tXA1376436 for ; Thu, 24 Jun 2010 20:09:55 +0200 Received: from d12av02.megacenter.de.ibm.com (loopback [127.0.0.1]) by d12av02.megacenter.de.ibm.com (8.12.11.20060308/8.13.3) with ESMTP id o5OI9sND014505 for ; Thu, 24 Jun 2010 20:09:54 +0200 Received: from tuxmaker.boeblingen.de.ibm.com (tuxmaker.boeblingen.de.ibm.com [9.152.85.9]) by d12av02.megacenter.de.ibm.com (8.12.11.20060308/8.12.11) with SMTP id o5OI9rPx014499 for ; Thu, 24 Jun 2010 20:09:53 +0200 Message-Id: <201006241809.o5OI9rPx014499@d12av02.megacenter.de.ibm.com> Received: by tuxmaker.boeblingen.de.ibm.com (sSMTP sendmail emulation); Thu, 24 Jun 2010 20:09:53 +0200 Subject: GDB crash due to endless recursion in namespace lookup To: gdb-patches@sourceware.org Date: Thu, 24 Jun 2010 18:10:00 -0000 From: "Ulrich Weigand" MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2010-06/txt/msg00540.txt.bz2 Hello, since one of this year's C++ namespace search related changes, GDB will go into an endless recursion and crash due to stack overflow when looking up symbols in the presence of a cycle in the "using" directive graph. For example, with the following test: namespace A { namespace B { using namespace ::A; } using namespace B; } using namespace A; class test { }; test x; int main() { } I'm seeing: (gdb) start Temporary breakpoint 1 at 0x80000626: file xxx.cc, line 16. Starting program: /home7/uweigand/fsf/gdb-head-build/gdb/a.out Temporary breakpoint 1, main () at xxx.cc:16 16 int main() { } (gdb) print x[0] Segmentation fault (core dumped) (The lookup that happens here is for operator[] -- which doesn't exist, but in trying to find it we run into the endless loop.) This is particularly annyoing as the SLES10 system library on s390 and ppc contains exactly this construct in the header /usr/include/c++/4.1.2/bits/localefwd.h: namespace std { namespace __gnu_cxx_ldbl128 { using namespace ::std; } using namespace __gnu_cxx_ldbl128 __attribute__((__strong__)); which means it is present in just about every C++ executable. (This seems specific to the SLES backport of the long-double compatibility support. The upstream implementation does not have this cycle ... But still, the general construct looks to be valid C++ as far as I can tell.) Any thoughts how to fix this? Bye, Ulrich -- Dr. Ulrich Weigand GNU Toolchain for Linux on System z and Cell BE Ulrich.Weigand@de.ibm.com