Hello.
After I've installed the patch, there's a small fallout I've been working on.
On of issue I met are lambda functions where we current ICE:
$ cat /tmp/use-after-scope-ice-1.ii
class A
{
public:
A () : value (123) {}
int value;
};
template <typename StoredFunction> class B
{
public:
template <typename F> B (F p1) : mFunction (p1) { mFunction (); }
StoredFunction mFunction;
};
template <typename Function>
void
NS_NewRunnableFunction (Function p1)
{
(B<Function> (p1));
}
class C
{
void DispatchConnectionCloseEvent (A);
void AsyncCloseConnectionWithErrorMsg (const A &);
};
void
C::AsyncCloseConnectionWithErrorMsg (const A &)
{
{
A message;
NS_NewRunnableFunction (
[this, message] { DispatchConnectionCloseEvent (message); });
}
}
Problematic is lambda function (use-after-scope-ice-1.ii.004t.gimple):
C::AsyncCloseConnectionWithErrorMsg(const A&)::<lambda()> (const struct
__lambda0 * const __closure)
{
const struct A message [value-expr: __closure->__message];
struct C * const this [value-expr: __closure->__this];
try
{
ASAN_MARK (2, &message, 4);
_1 = __closure->__this;
C::DispatchConnectionCloseEvent (_1, __closure->__message);
}
finally
{
ASAN_MARK (1, &message, 4);
}
}
Where for quite obvious reasons variables 'message' can't be put as a stack
variable and ICE is triggered in:
/tmp/use-after-scope-ice-1.ii:31:23: internal compiler error: in make_decl_rtl,
at varasm.c:1311
My question is how to properly identify local variables defined in __closure
context? Is it somehow
related to DECL_HAS_VALUE_EXPR_P field set on a var?
Thanks,
Martin