https://gcc.gnu.org/bugzilla/show_bug.cgi?id=49366
--- Comment #4 from Alexandre Oliva <aoliva at gcc dot gnu.org> --- Author: aoliva Date: Fri Aug 12 07:11:23 2016 New Revision: 239401 URL: https://gcc.gnu.org/viewcvs?rev=239401&root=gcc&view=rev Log: [PR49366] emit loc exprs for C++ non-virtual pmf template value parms We used to emit, in debug information, the values bound to pointer to member function template parameters only when they were NULL or virtual member functions, because those can be represented with DW_AT_const_value. In order to represent the symbolic pointer to member function constants for non-virtual member functions, we'd need to be able to emit relocations for part of DW_AT_const_value, which we don't. The more viable alternative is to use DW_AT_location to represent such values, as slated for inclusion in DWARFv5, according to <URL:http://www.dwarfstd.org/ShowIssue.php?issue=130412.1>. With this patch, when we can't emit a DW_AT_const_value, we emit each "member" of the pointer to member function "record" as a DW_OP_stack_value DW_OP_piece, as long as the referenced member function is output in the same translation unit, otherwise we'd get relocations to external symbols, something to avoid in debug sections. for gcc/ChangeLog PR debug/49366 * dwarf2out.c (loc_list_from_tree_1): Expand some CONSTRUCTORs in DW_OP_pieces, just enough to handle pointers to member functions. (gen_remaining_tmpl_value_param_die_attribute): Use a location expression on DWARFv5 if a constant value doesn't work. for gcc/testsuite/ChangeLog PR debug/49366 * g++.dg/debug/dwarf2/template-params-12.H: New. * g++.dg/debug/dwarf2/template-params-12f.C: New. * g++.dg/debug/dwarf2/template-params-12g.C: New. * g++.dg/debug/dwarf2/template-params-12n.C: New. * g++.dg/debug/dwarf2/template-params-12s.C: New. * g++.dg/debug/dwarf2/template-params-12u.C: New. * g++.dg/debug/dwarf2/template-params-12v.C: New. * g++.dg/debug/dwarf2/template-params-12w.C: New. Added: trunk/gcc/testsuite/g++.dg/debug/dwarf2/template-params-12.H trunk/gcc/testsuite/g++.dg/debug/dwarf2/template-params-12f.C trunk/gcc/testsuite/g++.dg/debug/dwarf2/template-params-12g.C trunk/gcc/testsuite/g++.dg/debug/dwarf2/template-params-12n.C trunk/gcc/testsuite/g++.dg/debug/dwarf2/template-params-12s.C trunk/gcc/testsuite/g++.dg/debug/dwarf2/template-params-12u.C trunk/gcc/testsuite/g++.dg/debug/dwarf2/template-params-12v.C trunk/gcc/testsuite/g++.dg/debug/dwarf2/template-params-12w.C Modified: trunk/gcc/ChangeLog trunk/gcc/dwarf2out.c trunk/gcc/testsuite/ChangeLog