On 10/24/18 7:24 PM, Jason Merrill wrote: > On Tue, Oct 23, 2018 at 4:59 AM Martin Liška <mli...@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*)
Hi. > > 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. I see, however I'm a rookie in area of C++ FE. Would it be solvable this problem with lambdas? > > 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. I added following patch which puts back type to const char[] (instead of char *) and I made the variable static. Now I see pretty4.C testcase passing again. To be honest I'm not convinced about the FE changes, so a help would be appreciated. Thanks, Martin > > Jason >
>From fd2e13b23e0bbbb7a7b02025432843782e1ab579 Mon Sep 17 00:00:00 2001 From: marxin <mli...@suse.cz> Date: Thu, 25 Oct 2018 18:12:10 +0200 Subject: [PATCH] Fix back. --- gcc/cp/decl.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index 9624df081e4..74ad871b3f4 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -4445,15 +4445,13 @@ cp_fname_init (const char* name, tree *type_p) type = cp_build_qualified_type (char_type_node, TYPE_QUAL_CONST); type = build_cplus_array_type (type, domain); - *type_p = type_decays_to (type); + *type_p = type; if (init) TREE_TYPE (init) = type; else init = error_mark_node; - init = decay_conversion (init, tf_warning_or_error); - return init; } @@ -4482,6 +4480,7 @@ cp_make_fname_decl (location_t loc, tree id, int type_dep) TREE_READONLY (decl) = 1; DECL_ARTIFICIAL (decl) = 1; DECL_DECLARED_CONSTEXPR_P (decl) = 1; + TREE_STATIC (decl) = 1; TREE_USED (decl) = 1; -- 2.19.0