On 3/1/24 11:45, Patrick Palka wrote:
On Fri, 1 Mar 2024, Jason Merrill wrote:
This was nearly enough to make things work, except we now ran into
issues with the local TYPE/CONST_DECL copies when streaming the
constexpr version of a function body. It occurred to me that we don't
need to make copies of local types when copying a constexpr function
body; only VAR_DECLs etc need to be copied for sake of recursive
constexpr calls. So this patch adjusts copy_fn accordingly.
Maybe adjust can_be_nonlocal instead? It seems unnecessary in general
to remap types and enumerators for inlining.
Unfortunately this approached caused a boostrap failure with Ada:
raised STORAGE_ERROR : stack overflow or erroneous memory access
The patch was
--- a/gcc/tree-inline.cc
+++ b/gcc/tree-inline.cc
@@ -725,6 +725,9 @@ can_be_nonlocal (tree decl, copy_body_data *id)
if (TREE_CODE (decl) == FUNCTION_DECL)
return true;
+ if (TREE_CODE (decl) == TYPE_DECL || TREE_CODE (decl) == CONST_DECL)
+ return true;
Hmm, maybe a problem with a local type whose size depends on a local
variable, so this would need to exclude that case. I suppose an
enumerator could also have a value of sizeof(local-var), even in C++.
Jason