From 3595df34b5a39efb5eb56ecb1439d8dd8458a587 Mon Sep 17 00:00:00 2001 From: Iain Buclaw Date: Sun, 21 Apr 2019 20:26:12 +0000 Subject: re PR d/90130 (gdc.test/runnable/test12.d FAILs) PR d/90130 d/dmd: Merge upstream dmd 065fbd452 Fixes endian bug in CTFE, and corrects tests in the D2 testsuite that failed on big endian targets. Initial patch by Robin Dapp. Reviewed-on: https://github.com/dlang/dmd/pull/9665 From-SVN: r270485 --- gcc/d/dmd/MERGE | 2 +- gcc/d/dmd/constfold.c | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) (limited to 'gcc/d') diff --git a/gcc/d/dmd/MERGE b/gcc/d/dmd/MERGE index be0c5a5..c360fe5 100644 --- a/gcc/d/dmd/MERGE +++ b/gcc/d/dmd/MERGE @@ -1,4 +1,4 @@ -c185f9df1789456c7d88d047f2df23dd784f1182 +065fbd452f2aa498fc3a554be48a5495bd98aa14 The first line of this file holds the git revision number of the last merge done from the dlang/dmd repository. diff --git a/gcc/d/dmd/constfold.c b/gcc/d/dmd/constfold.c index ddd356b..ed3e749 100644 --- a/gcc/d/dmd/constfold.c +++ b/gcc/d/dmd/constfold.c @@ -1752,14 +1752,16 @@ UnionExp Cat(Type *type, Expression *e1, Expression *e2) } else if (e1->op == TOKint64 && e2->op == TOKstring) { - // Concatenate the strings + // [w|d]?char ~ string --> string + // We assume that we only ever prepend one char of the same type + // (wchar,dchar) as the string's characters. StringExp *es2 = (StringExp *)e2; size_t len = 1 + es2->len; unsigned char sz = es2->sz; dinteger_t v = e1->toInteger(); void *s = mem.xmalloc((len + 1) * sz); - memcpy((char *)s, &v, sz); + Port::valcpy((char *)s, v, sz); memcpy((char *)s + sz, es2->string, es2->len * sz); // Add terminating 0 -- cgit v1.1