From patchwork Sun Mar 10 21:56:36 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Iain Buclaw X-Patchwork-Id: 1054061 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-497649-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none 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="RtUNmSrq"; 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 44HZpC4RHbz9sBF for ; Mon, 11 Mar 2019 08:57:02 +1100 (AEDT) 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:content-type; q= dns; s=default; b=pFrIIzAeLVaaADIM7RUq0LcSAqj89B4yOFJBXFJP1Tng6p svpuevsg2CuRD4OWD7AMTxcbGZ7/5Jql4K4QIylx6k4sjfQDufP83v155XC/gR1m QbO8pq5wfG6ozgUfwweKBatel4oLbLDSkTYYHlOeuF2tghJCFvKktwQZIxTFg= 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:content-type; s= default; bh=maLB5V9QcUC5x/htce5jiHv5HKk=; b=RtUNmSrqq4g5WtVi9M6p dkDvrxQ9FqSF7oRh6p/GvZie6U4pEWDyD8Hy0EJ9xrO5DjrSLT2nlb0feHmqoGoL +QSNW9Hic6c8gcvDWVhPmJvDiYsTSpfNodXUfEyHnhJ/XRe0wE3vrVSrF10J5Iyc FJgqxxVm6MMqYPnjvOUsnKM= Received: (qmail 98396 invoked by alias); 10 Mar 2019 21:56:51 -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 98349 invoked by uid 89); 10 Mar 2019 21:56:51 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-15.4 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=dg, delegates X-HELO: mail-qt1-f172.google.com Received: from mail-qt1-f172.google.com (HELO mail-qt1-f172.google.com) (209.85.160.172) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sun, 10 Mar 2019 21:56:49 +0000 Received: by mail-qt1-f172.google.com with SMTP id b3so3044459qtj.3 for ; Sun, 10 Mar 2019 14:56:49 -0700 (PDT) MIME-Version: 1.0 From: Iain Buclaw Date: Sun, 10 Mar 2019 22:56:36 +0100 Message-ID: Subject: [PATCH, PR d/87824] Committed fix for failing test gdc.test/runnable/nulltype.d To: gcc-patches X-IsSubscribed: yes This patch merges the D front-end implementation with dmd upstream fcc235e8e, fixing the failing nulltype.d test with -m32 on x86_64-linux. Bootstrapped and regression tested on x86_64-linux-gnu with RUNTESTFLAGS="--target_board=unix/\{,-m32\}". Committed to trunk as r269561. diff --git a/gcc/d/dmd/MERGE b/gcc/d/dmd/MERGE index 313748f70ae..cf5a22f070f 100644 --- a/gcc/d/dmd/MERGE +++ b/gcc/d/dmd/MERGE @@ -1,4 +1,4 @@ -da26db81943952c7e35dab98650df589ec122485 +fcc235e8e25f7758266f7874edd5abefb9943e0b 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/mtype.c b/gcc/d/dmd/mtype.c index 2a23cab74fd..900f172cccb 100644 --- a/gcc/d/dmd/mtype.c +++ b/gcc/d/dmd/mtype.c @@ -5331,9 +5331,16 @@ int Type::covariant(Type *t, StorageClass *pstc, bool fix17349) } else if (t1n->ty == t2n->ty && t1n->implicitConvTo(t2n)) goto Lcovariant; - else if (t1n->ty == Tnull && t1n->implicitConvTo(t2n) && - t1n->size() == t2n->size()) - goto Lcovariant; + else if (t1n->ty == Tnull) + { + // NULL is covariant with any pointer type, but not with any + // dynamic arrays, associative arrays or delegates. + // https://issues.dlang.org/show_bug.cgi?id=8589 + // https://issues.dlang.org/show_bug.cgi?id=19618 + Type *t2bn = t2n->toBasetype(); + if (t2bn->ty == Tnull || t2bn->ty == Tpointer || t2bn->ty == Tclass) + goto Lcovariant; + } } goto Lnotcovariant; diff --git a/gcc/testsuite/gdc.test/runnable/nulltype.d b/gcc/testsuite/gdc.test/runnable/nulltype.d index 32d117468ee..c400d7f61f1 100644 --- a/gcc/testsuite/gdc.test/runnable/nulltype.d +++ b/gcc/testsuite/gdc.test/runnable/nulltype.d @@ -127,7 +127,7 @@ void test8589() { void f(T function() dg) { assert(!dg()); } - static assert((T.sizeof == typeof(null).sizeof) == result); + static assert((is(typeof(null) function() : T function())) == result); static assert(is(typeof( f(&retnull) )) == result); static assert(is(typeof( f(()=>null) )) == result); static if (result) @@ -138,7 +138,7 @@ void test8589() } test!(true, int*)(); test!(true, Object)(); - test!(true, int[int])(); + test!(false, int[int])(); test!(false, int[])(); test!(false, void delegate())(); }