Fix for PR debug/46955

H.J. Lu hjl.tools@gmail.com
Fri Jan 14 17:13:00 GMT 2011


On Thu, Dec 16, 2010 at 12:30 AM, Dodji Seketeli <dodji@redhat.com> wrote:
> Hello,
>
> Consider this short example:
>
>  struct S { int f; };
>  template<int S::*MP> struct T { };
>  T<&S::f> v;
>
> The DW_TAG_template_value_param DIE created for type T<&S::f> lacks the
> DW_AT_const_value attribute which value should be the value of the
> pointer-to-member constant &S::f.
>
> The problem is tree_add_const_value_attribute doesn't know how to fold
> the C++ specific PTRMEM_CST representing &S::f.
>
> This patch ensures that template arguments -- especially
> PTRMEM_CST nodes -- that are retrieved with
> lang_hooks.get_innermost_generic_args and
> lang_hooks.types.get_argument_pack_elems are folded enough for the
> DWARF emitter.
>
> Bootstrapped and tested on x86_64-unknown-linux against trunk.
>
> --
>        Dodji
>
> commit 7c4f02c2f2c83a9df8e21de0f6ca0c38242bebc0
> Author: Dodji Seketeli <dodji@redhat.com>
> Date:   Wed Dec 15 13:03:44 2010 +0100
>
>    Fix PR debug/46955
>
>    gcc/cp/
>
>        * cp-lang.c (get_template_innermost_arguments_folded)
>        (get_template_argument_pack_elems_folded)
>        (template_arg_needs_folding, fold_cplus_constants): New static
>        functions.
>        (LANG_HOOKS_GET_INNERMOST_GENERIC_ARGS): Set this hook to
>        get_template_innermost_arguments_folded.
>        (LANG_HOOKS_GET_ARGUMENT_PACK_ELEMS): Set this hook to
>        get_template_argument_pack_elems_folded.
>

This caused:

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47291

-- 
H.J.



More information about the Gcc-patches mailing list