From: "Ulrich Weigand" <uweigand@de.ibm.com>
To: gdb-patches@sourceware.org
Subject: GDB crash due to endless recursion in namespace lookup
Date: Thu, 24 Jun 2010 18:10:00 -0000 [thread overview]
Message-ID: <201006241809.o5OI9rPx014499@d12av02.megacenter.de.ibm.com> (raw)
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
next reply other threads:[~2010-06-24 18:10 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-06-24 18:10 Ulrich Weigand [this message]
2010-06-25 15:46 ` sami wagiaalla
2010-06-25 16:24 ` Ulrich Weigand
2010-06-25 16:56 ` Sami Wagiaalla
2010-06-25 16:20 ` [commit] Fix " Ulrich Weigand
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=201006241809.o5OI9rPx014499@d12av02.megacenter.de.ibm.com \
--to=uweigand@de.ibm.com \
--cc=gdb-patches@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).