This fixes builds on systems where __builtin_machine_uint != size_t. In D, casts from larger to smaller integer size need to be made explicitly. Most notably this fixes --disable-tls for MIPS64 systems.
libphobos/ChangeLog: 2019-05-02 Johannes Pfau <johannesp...@gmail.com> * libdruntime/gcc/emutls.d: Add explicit casts to size_t. --- libphobos/libdruntime/gcc/emutls.d | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/libphobos/libdruntime/gcc/emutls.d b/libphobos/libdruntime/gcc/emutls.d index 461f20d9e28..1f8bbf5d69e 100644 --- a/libphobos/libdruntime/gcc/emutls.d +++ b/libphobos/libdruntime/gcc/emutls.d @@ -197,7 +197,7 @@ void** emutlsAlloc(shared __emutls_object* obj) nothrow @nogc emutls_destroy accordingly. */ if ((cast() obj).align_ <= pointerSize) { - ptr = malloc((cast() obj).size + pointerSize); + ptr = malloc(cast(size_t)((cast() obj).size + pointerSize)); if (ptr == null) abort(); (cast(void**) ptr)[0] = ptr; @@ -205,7 +205,7 @@ void** emutlsAlloc(shared __emutls_object* obj) nothrow @nogc } else { - ptr = malloc(obj.size + pointerSize + obj.align_ - 1); + ptr = malloc(cast(size_t)(obj.size + pointerSize + obj.align_ - 1)); if (ptr == null) abort(); ret = cast(void*)((cast(pointer)(ptr + pointerSize + obj.align_ - 1)) & ~cast( @@ -214,9 +214,9 @@ void** emutlsAlloc(shared __emutls_object* obj) nothrow @nogc } if (obj.templ) - memcpy(ret, cast(ubyte*) obj.templ, cast() obj.size); + memcpy(ret, cast(ubyte*) obj.templ, cast(size_t) obj.size); else - memset(ret, 0, cast() obj.size); + memset(ret, 0, cast(size_t) obj.size); return cast(void**) ret; } -- 2.19.2