From patchwork Sun Mar 10 17:26:55 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Iain Buclaw X-Patchwork-Id: 1054034 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-497640-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="oA0+3raP"; 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 44HSps4gkWz9sDB for ; Mon, 11 Mar 2019 04:27:17 +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=QYUxN5Gj8nvYci3YNFbDUhc7r5+96oq4sWBknyu6AM4kD9 dNbZrHjMTufK11e+1zVzn1stqbqUfjiSZ2QLJI9SbFBYy/lAi9DZHxYbiwBCLKuI lP1LJ/5YjzM6tOgTA1qGnvad6qcw0NEPoyhDut+i/bXzdmiHmYdLFFqXr07xk= 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=Xg+547sbAGPKIHjGqvAv/lNGP0w=; b=oA0+3raPvK+SlQT7YoAU Aea4Xp+rHeK4yUJ5017GgHolVN2JTmyJw2+AM7ZEyjME8pik0NjIeS6hI5IwTn3g SzkWGrudtbXamvABlaqUEc7Dn5UZzj/wdo6HJNskRwYawuBr8z4RG0JnwRbFpUC1 LGs1hyU5vZPnNT/5dmPlO+M= Received: (qmail 80400 invoked by alias); 10 Mar 2019 17:27:10 -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 80389 invoked by uid 89); 10 Mar 2019 17:27:10 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-15.2 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=23, 8, *id, msg 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 17:27:09 +0000 Received: by mail-qt1-f172.google.com with SMTP id z17so2616568qtn.4 for ; Sun, 10 Mar 2019 10:27:08 -0700 (PDT) MIME-Version: 1.0 From: Iain Buclaw Date: Sun, 10 Mar 2019 18:26:55 +0100 Message-ID: Subject: [PATCH, PR d/89016] Committed updated fix for ICE in dmd/expression.c To: gcc-patches X-IsSubscribed: yes Hi, This patch merges the D front-end implementation with dmd upstream da26db819, backporting a supplementary fix for ICE on importing modules marked as deprecated, but with a non-string message. Bootstrapped and regression tested on x86_64-linux-gnu. Committed to trunk as r269560. diff --git a/gcc/d/dmd/MERGE b/gcc/d/dmd/MERGE index 98bf8254554..313748f70ae 100644 --- a/gcc/d/dmd/MERGE +++ b/gcc/d/dmd/MERGE @@ -1,4 +1,4 @@ -0fc786f4908aa6bdd4220af87995333b1f24c3d7 +da26db81943952c7e35dab98650df589ec122485 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/dimport.c b/gcc/d/dmd/dimport.c index cd2c5b22a74..3d899f09b52 100644 --- a/gcc/d/dmd/dimport.c +++ b/gcc/d/dmd/dimport.c @@ -23,8 +23,6 @@ #include "attrib.h" #include "hdrgen.h" -StringExp *semanticString(Scope *sc, Expression *exp, const char *s); - /********************************* Import ****************************/ Import::Import(Loc loc, Identifiers *packages, Identifier *id, Identifier *aliasId, @@ -175,19 +173,17 @@ void Import::importAll(Scope *sc) load(sc); if (mod) // if successfully loaded module { + mod->importAll(NULL); + if (mod->md && mod->md->isdeprecated) { Expression *msg = mod->md->msg; - if (msg) - msg = semanticString(sc, msg, "deprecation message"); if (StringExp *se = msg ? msg->toStringExp() : NULL) mod->deprecation(loc, "is deprecated - %s", se->string); else mod->deprecation(loc, "is deprecated"); } - mod->importAll(NULL); - if (sc->explicitProtection) protection = sc->protection; if (!isstatic && !aliasId && !names.dim) diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail19609.d b/gcc/testsuite/gdc.test/fail_compilation/fail19609.d index 64d080ac5d0..26ef57693b7 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/fail19609.d +++ b/gcc/testsuite/gdc.test/fail_compilation/fail19609.d @@ -3,16 +3,17 @@ TEST_OUTPUT --- fail_compilation/imports/fail19609a.d(1): Error: `string` expected for deprecation message, not `([""])` of type `string[]` -fail_compilation/fail19609.d(16): Deprecation: module `imports.fail19609a` is deprecated -fail_compilation/imports/fail19609a.d(1): Error: `string` expected for deprecation message, not `([""])` of type `string[]` -fail_compilation/imports/fail19609b.d(1): Error: `string` expected for deprecation message, not `([1])` of type `int[]` -fail_compilation/fail19609.d(17): Deprecation: module `imports.fail19609b` is deprecated +fail_compilation/fail19609.d(15): Deprecation: module `imports.fail19609a` is deprecated fail_compilation/imports/fail19609b.d(1): Error: `string` expected for deprecation message, not `([1])` of type `int[]` +fail_compilation/fail19609.d(16): Deprecation: module `imports.fail19609b` is deprecated fail_compilation/imports/fail19609c.d(1): Error: `string` expected for deprecation message, not `(123.4F)` of type `float` -fail_compilation/fail19609.d(18): Deprecation: module `imports.fail19609c` is deprecated -fail_compilation/imports/fail19609c.d(1): Error: `string` expected for deprecation message, not `(123.4F)` of type `float` +fail_compilation/fail19609.d(17): Deprecation: module `imports.fail19609c` is deprecated +fail_compilation/imports/fail19609d.d(1): Error: undefined identifier `msg` +fail_compilation/fail19609.d(19): Deprecation: module `imports.fail19609d` is deprecated --- */ import imports.fail19609a; import imports.fail19609b; import imports.fail19609c; +enum msg = "You should not be able to see me"; +import imports.fail19609d; diff --git a/gcc/testsuite/gdc.test/fail_compilation/imports/fail19609d.d b/gcc/testsuite/gdc.test/fail_compilation/imports/fail19609d.d new file mode 100644 index 00000000000..0955ca4fac2 --- /dev/null +++ b/gcc/testsuite/gdc.test/fail_compilation/imports/fail19609d.d @@ -0,0 +1,2 @@ +deprecated(msg) module imports.fail19609d; +enum msg = "You won't see this either";