From patchwork Mon Apr 22 13:56:15 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Iain Buclaw X-Patchwork-Id: 1088715 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-499531-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=quarantine dis=none) header.from=gdcproject.org Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="GlSvOVbf"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 44np5x0tc1z9s3Z for ; Mon, 22 Apr 2019 23:56:36 +1000 (AEST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :mime-version:from:date:message-id:subject:to:cc:content-type; q=dns; s=default; b=rD+7YCoPIq3X4LycM1sovEvJ3jlDJubu/FUm2GjS0mK yxxxqQaxO9z27OgJPvj20VtKFjnUplIWrH3E5f7fPa3DlLgL2xFjkw9CaiWlyFxC Kw2X/BrAeFRBKmadIwl/4NrJLGtFsTuCXmIuATgmQdHksHx5pwiPpVICVamTtFZI = DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :mime-version:from:date:message-id:subject:to:cc:content-type; s=default; bh=KLh7V/p8woSIfBvBL47EzVBPz2M=; b=GlSvOVbf+iIGPSYfm zQ3TlsOucM1Ln7AKHMOY6Tvuz7BTAI/8DRSQVEkLzokGsb+0IqMUpVoBItsq73BK dXZ4Ik5Xl/YBR2c4Emr8H1OoOPWeslpR2jfQroFuSFIES3K9tGolbFRBCtv2n6Yi y2XXU1F4x7OanVm9ZkIW5luX7I= Received: (qmail 28615 invoked by alias); 22 Apr 2019 13:56:30 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 28177 invoked by uid 89); 22 Apr 2019 13:56:30 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-19.5 required=5.0 tests=AWL, BAYES_00, FREEMAIL_FROM, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.1 spammy=12458, userdefined, user-defined X-HELO: mail-qk1-f173.google.com Received: from mail-qk1-f173.google.com (HELO mail-qk1-f173.google.com) (209.85.222.173) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 22 Apr 2019 13:56:28 +0000 Received: by mail-qk1-f173.google.com with SMTP id n81so2557308qke.2 for ; Mon, 22 Apr 2019 06:56:28 -0700 (PDT) MIME-Version: 1.0 From: Iain Buclaw Date: Mon, 22 Apr 2019 15:56:15 +0200 Message-ID: Subject: [PATCH, libphobos] Committed merge with upstream phobos b538f758a. To: gcc-patches Cc: Robin Dapp X-IsSubscribed: yes Hi, This patch merges the libphobos library with upstream phobos b538f758a. Fixes endian bugs in std.uni, and corrects unit-tests that failed on version(BigEndian) targets, with good results on s390-linux-gnu. Bootstrapped and regression tested on x86_64-linux-gnu. Committed to trunk as r270491. diff --git a/libphobos/src/MERGE b/libphobos/src/MERGE index 3935c059403..e4807fbf437 100644 --- a/libphobos/src/MERGE +++ b/libphobos/src/MERGE @@ -1,4 +1,4 @@ -428460ddd8087fa28815e613ff04facb51108a7b +b538f758a4d274b64751f80564b0207845cd018c The first line of this file holds the git revision number of the last merge done from the dlang/phobos repository. diff --git a/libphobos/src/std/net/curl.d b/libphobos/src/std/net/curl.d index e3ce527c303..32ba45ce2de 100644 --- a/libphobos/src/std/net/curl.d +++ b/libphobos/src/std/net/curl.d @@ -207,9 +207,7 @@ version (unittest) } catch (Throwable e) { - import core.stdc.stdlib : exit, EXIT_FAILURE; - stderr.writeln(e); - exit(EXIT_FAILURE); // Bugzilla 7018 + stderr.writeln(e); // Bugzilla 7018 } } } diff --git a/libphobos/src/std/outbuffer.d b/libphobos/src/std/outbuffer.d index 1d594982cc1..d76ead2ed49 100644 --- a/libphobos/src/std/outbuffer.d +++ b/libphobos/src/std/outbuffer.d @@ -408,11 +408,17 @@ class OutBuffer { OutBuffer buf = new OutBuffer(); "hello"w.copy(buf); - assert(buf.toBytes() == "h\x00e\x00l\x00l\x00o\x00"); + version (LittleEndian) + assert(buf.toBytes() == "h\x00e\x00l\x00l\x00o\x00"); + version (BigEndian) + assert(buf.toBytes() == "\x00h\x00e\x00l\x00l\x00o"); } { OutBuffer buf = new OutBuffer(); "hello"d.copy(buf); - assert(buf.toBytes() == "h\x00\x00\x00e\x00\x00\x00l\x00\x00\x00l\x00\x00\x00o\x00\x00\x00"); + version (LittleEndian) + assert(buf.toBytes() == "h\x00\x00\x00e\x00\x00\x00l\x00\x00\x00l\x00\x00\x00o\x00\x00\x00"); + version (BigEndian) + assert(buf.toBytes() == "\x00\x00\x00h\x00\x00\x00e\x00\x00\x00l\x00\x00\x00l\x00\x00\x00o"); } } diff --git a/libphobos/src/std/uni.d b/libphobos/src/std/uni.d index 5f24ad16be5..0b3da58286c 100644 --- a/libphobos/src/std/uni.d +++ b/libphobos/src/std/uni.d @@ -770,6 +770,8 @@ version (X86) enum hasUnalignedReads = true; else version (X86_64) enum hasUnalignedReads = true; +else version (SystemZ) + enum hasUnalignedReads = true; else enum hasUnalignedReads = false; // better be safe then sorry @@ -1245,8 +1247,13 @@ pure nothrow: T opIndex(size_t idx) inout { - return __ctfe ? simpleIndex(idx) : - cast(inout(T))(cast(U*) origin)[idx]; + T ret; + version (LittleEndian) + ret = __ctfe ? simpleIndex(idx) : + cast(inout(T))(cast(U*) origin)[idx]; + else + ret = simpleIndex(idx); + return ret; } static if (isBitPacked!T) // lack of user-defined implicit conversion @@ -1259,10 +1266,15 @@ pure nothrow: void opIndexAssign(TypeOfBitPacked!T val, size_t idx) { - if (__ctfe) - simpleWrite(val, idx); + version (LittleEndian) + { + if (__ctfe) + simpleWrite(val, idx); + else + (cast(U*) origin)[idx] = cast(U) val; + } else - (cast(U*) origin)[idx] = cast(U) val; + simpleWrite(val, idx); } } else diff --git a/libphobos/src/std/xml.d b/libphobos/src/std/xml.d index 770c56fdbfb..13241f53613 100644 --- a/libphobos/src/std/xml.d +++ b/libphobos/src/std/xml.d @@ -2201,8 +2201,10 @@ private mixin Check!("Chars"); dchar c; - int n = -1; - foreach (int i,dchar d; s) + ptrdiff_t n = -1; + // 'i' must not be smaller than size_t because size_t is used internally in + // aApply.d and it will be cast e.g to (int *) which fails on BigEndian targets. + foreach (size_t i, dchar d; s) { if (!isChar(d)) { @@ -2238,8 +2240,10 @@ private mixin Check!("Name"); if (s.length == 0) fail(); - int n; - foreach (int i,dchar c;s) + ptrdiff_t n; + // 'i' must not be smaller than size_t because size_t is used internally in + // aApply.d and it will be cast e.g to (int *) which fails on BigEndian targets. + foreach (size_t i, dchar c; s) { if (c == '_' || c == ':' || isLetter(c)) continue; if (i == 0) fail();