[PATCH] Make __PRETTY_FUNCTION__-like functions mergeable string csts (PR c++/64266).

Jason Merrill jason@redhat.com
Wed Oct 24 18:55:00 GMT 2018


On Tue, Oct 23, 2018 at 4:59 AM Martin Liška <mliska@suse.cz> wrote:
> However, I still see some minor ICEs, it's probably related to decay_conversion in cp_fname_init:
>
> 1) ./xg++ -B. /home/marxin/Programming/gcc/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-__func__2.C
>
> /home/marxin/Programming/gcc/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-__func__2.C:6:17: internal compiler error: Segmentation fault
> 6 |     [] { return __func__; }();
>   |                 ^~~~~~~~
> 0x1344568 crash_signal
>         /home/marxin/Programming/gcc/gcc/toplev.c:325
> 0x7ffff6bc310f ???
>         /usr/src/debug/glibc-2.27-6.1.x86_64/signal/../sysdeps/unix/sysv/linux/x86_64/sigaction.c:0
> 0x9db134 is_capture_proxy(tree_node*)

The problem in both tests is that is_capture_proxy thinks your
__func__ VAR_DECL with DECL_VALUE_EXPR is a capture proxy, since it is
neither an anonymous union proxy nor a structured binding.

The standard says,

The function-local predefined variable __func__ is defined as if a
definition of the form
   static const char __func__[] = "function-name ";
had been provided, where function-name is an implementation-defined
string. It is unspecified whether such a variable has an address
distinct from that of any other object in the program.

So changing the type of __func__ (from array to pointer) still breaks
conformance.  And we need to keep the type checks from pretty4.C, even
though the checks for strings being distinct need to go.

Jason



More information about the Gcc-patches mailing list