[Issue 22124] New: Corrupted closure when compiling with -preview=dip1000
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Wed Jul 14 07:47:26 UTC 2021
https://issues.dlang.org/show_bug.cgi?id=22124
Issue ID: 22124
Summary: Corrupted closure when compiling with -preview=dip1000
Product: D
Version: D2
Hardware: x86_64
OS: Linux
Status: NEW
Keywords: wrong-code
Severity: critical
Priority: P1
Component: dmd
Assignee: nobody at puremagic.com
Reporter: dlang-bugzilla at thecybershadow.net
The following program will segfault when compiled with -preview=dip1000, but
not otherwise:
/////////////// test.d //////////////
import core.thread;
static import std.parallelism; // ???
struct Elem
{
uint[16] pad;
}
Elem[] arr;
void main(string[] args)
{
arr = new Elem[1];
fun1();
}
void fun1()
{
fun2();
}
void fun2()
{
fun3();
}
void fun3()
{
foreach (ref elem; arr)
fun4(elem);
}
void fun4(ref Elem elem)
{
auto pelem = &elem;
auto thread = new Thread({
assert(&elem is pelem);
});
thread.start();
}
/////////////////////////////////////
--
More information about the Digitalmars-d-bugs
mailing list