[RFA] Fix c++/14365

Keith Seitz keiths@redhat.com
Tue Aug 7 21:42:00 GMT 2012


Hi,

c++/14365 deals with a crash caused dwarf2_physname when computing 
physnames for functions which take a member pointer parameter when the 
containing class of this member pointer is anonymous. This situation can 
occur with templates and lambda expressions. [See the PR for an example.]

Currently with unnamed/anonymous structs/classes/unions, 
c_type_print_varspec_prefix will pass SHOW = 0 to c_type_print_base*, 
which will cause c_type_print_base to attempt to print the internals of 
the struct/class/unio*. In doing so, the code will eventually attempt to 
ascertain whether the method represents a ctor, and because TYPE_NAME is 
NULL, the code causes a segfaults.

[* I do not see any tests in the test suite to exercise the TYPE_NAME == 
NULL branch of these cases.]

I propose the following, which changes c_type_print_varspec_prefix to 
not print any sort of "details" (SHOW >=0) for member pointers and 
method pointers.

Keith

ChangeLog
2012-08-07  Keith Seitz  <keiths@redhat.com>

	PR c++/14365
	* c-typeprint.c (c_type_print_varspec_prefix): Pass
	-1 for SHOW to c_type_print_base for METHODPTR and MEMBERPTR.

testsuite/ChangeLog
2012-08-07  Keith Seitz  <keiths@redhat.com>

	PR c++/14365
	* gdb.dwarf2/dw2-anon-mptr.exp: New file.
	* gdb.dwarf2/dw2-anon-mptr.S: New file.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pr14365.patch
Type: text/x-patch
Size: 14072 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/gdb-patches/attachments/20120807/53145fde/attachment.bin>


More information about the Gdb-patches mailing list