Skip to content

Commit 751590e

Browse files
authored
druntime-test: memoryerror_stackoverflow try harder to avoid optimizations (dlang/dmd!21742)
gdc and ldc2 with llvm-20 optimize away the array declarations leading to an infinite cycle. See-Also: #4969 Signed-off-by: Andrei Horodniceanu <[email protected]>
1 parent 9dcc91a commit 751590e

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

runtime/druntime/test/exceptions/src/memoryerror_stackoverflow.d

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,19 @@
11
import etc.linux.memoryerror;
2+
import core.volatile;
23

34
pragma(inline, false):
45

56
void f(ref ubyte[1024] buf)
67
{
78
ubyte[1024] cpy = buf;
9+
volatileStore(&cpy[0], 1);
810
g(cpy);
911
}
1012

1113
void g(ref ubyte[1024] buf)
1214
{
1315
ubyte[1024] cpy = buf;
16+
volatileStore(&cpy[0], 2);
1417
f(cpy);
1518
}
1619

0 commit comments

Comments
 (0)