https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91155

Martin Liška <marxin at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jason at gcc dot gnu.org

--- Comment #3 from Martin Liška <marxin at gcc dot gnu.org> ---
So with current trunk and simplified test-case:

template< char C > struct dummy {};
template< typename T > void test()
{
  __builtin_printf ("%s\n", __PRETTY_FUNCTION__);
}

int main()
{
    test< dummy< '\0' > >();
}

We end here:

$ (gdb) bt
#0  fname_as_string (pretty_p=<optimized out>) at
/home/marxin/Programming/gcc/gcc/c-family/c-common.c:687
#1  0x00000000009404ff in cp_make_fname_decl (loc=255730, id=<identifier_node
0x7ffff76a7bc0 __PRETTY_FUNCTION__>, type_dep=1) at
/home/marxin/Programming/gcc/gcc/cp/decl.c:4501
#2  0x0000000000a4ef90 in tsubst_expr (t=<decl_expr 0x7ffff7803500>,
args=<tree_vec 0x7ffff78035c0>, complain=3, in_decl=<template_decl
0x7ffff76ca300 test>, integral_constant_expression_p=<optimized out>) at
/home/marxin/Programming/gcc/gcc/tree.h:3335
#3  0x0000000000a4bb2b in tsubst_expr (t=<statement_list 0x7ffff7803440>,
args=<tree_vec 0x7ffff78035c0>, complain=3, in_decl=<template_decl
0x7ffff76ca300 test>, integral_constant_expression_p=<optimized out>) at
/home/marxin/Programming/gcc/gcc/tree-iterator.h:92
#4  0x0000000000a4a23a in tsubst_expr (t=<bind_expr 0x7ffff780b2d0>,
args=<tree_vec 0x7ffff78035c0>, complain=3, in_decl=<template_decl
0x7ffff76ca300 test>, integral_constant_expression_p=<optimized out>) at
/home/marxin/Programming/gcc/gcc/tree.h:3721
#5  0x0000000000a49ac9 in instantiate_decl (d=<optimized out>,
defer_ok=<optimized out>, expl_inst_class_mem_p=<optimized out>) at
/home/marxin/Programming/gcc/gcc/tree.h:3221
#6  0x0000000000a704ec in instantiate_pending_templates
(retries=retries@entry=0) at /home/marxin/Programming/gcc/gcc/cp/pt.c:24896
#7  0x0000000000988671 in c_parse_final_cleanups () at
/home/marxin/Programming/gcc/gcc/cp/decl2.c:4857
#8  0x0000000000fe6a70 in compile_file () at
/home/marxin/Programming/gcc/gcc/toplev.c:456
#9  0x00000000008b6788 in do_compile () at
/home/marxin/Programming/gcc/gcc/toplev.c:2188
#10 toplev::main (this=this@entry=0x7fffffffd9fe, argc=<optimized out>,
argc@entry=20, argv=<optimized out>, argv@entry=0x7fffffffdaf8) at
/home/marxin/Programming/gcc/gcc/toplev.c:2323
#11 0x00000000008ba24f in main (argc=20, argv=0x7fffffffdaf8) at
/home/marxin/Programming/gcc/gcc/main.c:39

$ (gdb) p strname
$19 = {
  len = 38, 
  text = 0x2671870 "\"void test() [with T = dummy<'\\000'>]\""
}

and then cpp_interpret_string (parse_in, &strname, 1, &cstr, CPP_STRING)) is
called and we end up with:

$ (gdb) p cstr.text
$20 = (const unsigned char *) 0x26718a0 "void test() [with T = dummy<'"

Jason, may I ask for a help what to do here?

Reply via email to