libphobos/ChangeLog:
* libdruntime/MERGE: Merge upstream druntime
d2ee11364c.
* testsuite/libphobos.aa/test_aa.d: Add new test.
* testsuite/libphobos.betterc/test19933.d: Adjust imports.
* testsuite/libphobos.config/test22523.d: Likewise.
* testsuite/libphobos.exceptions/assert_fail.d: Adjust test.
* testsuite/libphobos.exceptions/chain.d: Adjust imports.
* testsuite/libphobos.exceptions/future_message.d: Likewise.
* testsuite/libphobos.exceptions/line_trace.d: Likewise.
* testsuite/libphobos.exceptions/long_backtrace_trunc.d: Likewise.
* testsuite/libphobos.exceptions/static_dtor.d: Likewise.
* testsuite/libphobos.gc/forkgc.d: Likewise.
* testsuite/libphobos.gc/precisegc.d: Likewise.
* testsuite/libphobos.gc/recoverfree.d: Likewise.
* testsuite/libphobos.hash/test_hash.d: Likewise.
* testsuite/libphobos.init_fini/custom_gc.d: Likewise.
* testsuite/libphobos.init_fini/thread_join.d: Likewise.
* testsuite/libphobos.thread/external_threads.d: Likewise.
* testsuite/libphobos.thread/fiber_guard_page.d: Likewise.
* testsuite/libphobos.thread/tlsgc_sections.d: Likewise.
* testsuite/libphobos.thread/tlsstack.d: Likewise.
* testsuite/libphobos.unittest/customhandler.d: Likewise.
-603225372b211bb66dd0ea1a939043ace5a650cf
+d2ee11364c25ca8865eb0acb9596a6147532ef41
The first line of this file holds the git revision number of the last
merge done from the dlang/dmd repository.
testZeroSizedValue();
testTombstonePurging();
testClear();
+ testTypeInfoCollect();
}
void testKeysValues1()
void issue14104()
{
- import core.stdc.stdio;
-
alias K = const(ubyte)*;
size_t[K] aa;
immutable key = cast(K)(cast(size_t) uint.max + 1);
assert(aa.length == 1);
assert(aa[5] == 6);
}
+
+// https://github.com/dlang/dmd/issues/17503
+void testTypeInfoCollect()
+{
+ import core.memory;
+
+ static struct S
+ {
+ int x;
+ ~this() {}
+ }
+
+ static struct AAHolder
+ {
+ S[int] aa;
+ }
+
+ static S* getBadS()
+ {
+ auto aaholder = new AAHolder;
+ aaholder.aa[0] = S();
+ auto s = 0 in aaholder.aa; // keep a pointer to the entry
+ GC.free(aaholder); // but not a pointer to the AA.
+ return s;
+ }
+
+ static void stackStomp()
+ {
+ import core.stdc.string : memset;
+ ubyte[4 * 4096] x;
+ memset(x.ptr, 0, x.sizeof);
+ }
+
+ auto s = getBadS();
+ stackStomp(); // destroy any stale references to the AA or s except in the current frame;
+ GC.collect(); // BUG: this used to invalidate the fake type info, should no longer do this.
+ foreach(i; 0 .. 1000) // try to reallocate the freed type info
+ auto p = new void*[1];
+ s = null; // clear any reference to the entry
+ GC.collect(); // used to segfault.
+}
// https://issues.dlang.org/show_bug.cgi?id=19933
// https://issues.dlang.org/show_bug.cgi?id=18816
-import core.stdc.stdio;
+import core.stdc.stdio : fprintf, stderr;
extern(C) int main()
{
// https://issues.dlang.org/show_bug.cgi?id=22523
-import core.stdc.stdio;
+import core.stdc.stdio : puts;
int main()
{
new long[100];
}
+ static void clobberStack()
+ {
+ ubyte[1024] clobber;
+ clobber[] = 0xff;
+ }
+
import core.memory : GC;
createGarbage();
+ // ensure there are no stale references on the stack
+ clobberStack();
GC.collect();
assert(Test.run);
// Author: Ali Çehreli
// See https://forum.dlang.org/post/o2n7f8$2p1t$1@digitalmars.com
-import core.stdc.stdio;
+import core.stdc.stdio : printf;
class TestException : Exception
{
// { dg-options "-Wno-deprecated" }
-import core.stdc.stdio;
+import core.stdc.stdio : fprintf, stderr;
// Make sure basic stuff works with future Throwable.message
class NoMessage : Throwable
}
catch (Exception e)
{
- import core.stdc.stdio;
+ import core.stdc.stdio : printf;
auto str = e.toString();
printf("%.*s\n", cast(int)str.length, str.ptr);
}
HHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH x;
x.tttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttt(1);
} catch (Exception e) {
- import core.stdc.stdio;
+ import core.stdc.stdio : printf;
auto str = e.toString();
printf("%.*s\n", cast(int)str.length, str.ptr);
}
// { dg-shouldfail "static_dtor_exception" }
// { dg-output "object.Exception@.*: static_dtor_exception" }
// https://issues.dlang.org/show_bug.cgi?id=16594
-import core.stdc.stdio;
+import core.stdc.stdio : fprintf, stderr;
shared static ~this()
{
import core.memory;
-import core.stdc.stdio;
+import core.stdc.stdio : printf;
import core.sys.posix.sys.wait;
import core.sys.posix.unistd;
module testgc;
import core.memory;
-import core.stdc.stdio;
+import core.stdc.stdio : printf;
class C
{
// https://issues.dlang.org/show_bug.cgi?id=20438
-import core.stdc.stdio;
import core.memory;
void main()
~this() @nogc nothrow
{
- import core.stdc.stdio;
+ import core.stdc.stdio : puts;
if (mptr) puts("impure");
}
~this() @nogc nothrow
{
- import core.stdc.stdio;
+ import core.stdc.stdio : puts;
if (fd != -1) puts("impure");
}
-import core.gc.registry;
import core.gc.gcinterface;
-import core.stdc.stdlib;
+import core.gc.registry;
+import core.stdc.stdlib : calloc, malloc, realloc;
static import core.memory;
// Bugzilla 11309 - std.concurrency: OwnerTerminated message doesn't work
// We need to assure that the thread dtors of parent threads run before the thread dtors of the child threads.
import core.thread, core.sync.semaphore;
-import core.stdc.stdio;
__gshared Semaphore sem;
-import core.sys.posix.pthread;
import core.memory;
+import core.sys.posix.pthread : pthread_create, pthread_join;
+import core.sys.posix.sys.types : pthread_t;
import core.thread;
extern (C) void rt_moduleTlsCtor();
// { dg-options "-O0" }
// { dg-shouldfail "segv or bus error" }
import core.thread;
-import core.sys.posix.signal;
-import core.sys.posix.sys.mman;
+import core.sys.posix.signal : MINSIGSTKSZ;
+import core.sys.posix.sys.mman : MAP_ANON, MAP_PRIVATE, mmap, PROT_READ, PROT_WRITE;
version (LDC) import ldc.attributes;
else struct optStrategy { string a; }
{
~this()
{
- import core.stdc.stdlib;
+ import core.stdc.stdlib : abort;
abort(); // this gets triggered although the instance always stays referenced
}
}
module core.thread.test; // needs access to getStackTop()/getStackBottom()
-import core.stdc.stdio;
+import core.stdc.stdio : printf;
import core.thread;
ubyte[16384] data;
void main()
{
- import core.stdc.stdio;
+ import core.stdc.stdio : fprintf, stderr;
fprintf(stderr, "main\n");
}