From patchwork Sun Mar 10 16:30:05 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Iain Buclaw X-Patchwork-Id: 1054028 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-497634-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="GS+qNcIL"; 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 44HRYc5jjhz9sBp for ; Mon, 11 Mar 2019 03:30:42 +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=Du5W7S94OLflDZ784mOEHAu+dKZvpecwrGfTuhMQ0P7Cz/ 1jqszbY/X48eMik7GN64bfTj//dVrkYY8DoBxpG2Kfqv3eJ88/szOZyQwX9I4zVp 2igAw8oOuWz4jtx2PhQ09zwFnXcQszfhvCf2ZrQ8+RWsG+0JMVW++LN5UfQw8= 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=jTBdL/hCZtgGZZxdMxOKsaTNHEo=; b=GS+qNcIL016AAa/dj5Am tbDSxqz+3nBpUGGjvQ7UsjzMfMmhFE+pcs4Ck6Ghr5b7e8iGEHUT6E9dCXVKj67U gjDgzsxFfEFA+WR72RyVbuxWFoF83uM+Ry0+aDQ+BBHz2aUrbwevjo4Hzl/y06Yt +q7Wagt/nQDeu3M/rS0YpPo= Received: (qmail 63799 invoked by alias); 10 Mar 2019 16:30:34 -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 63772 invoked by uid 89); 10 Mar 2019 16:30:34 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-14.7 required=5.0 tests=AWL, BAYES_00, FREEMAIL_FROM, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_NUMSUBJECT, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.1 spammy=HX-Received:6bc6, dmd, expressionsemc, dlang 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; Sun, 10 Mar 2019 16:30:23 +0000 Received: by mail-qk1-f173.google.com with SMTP id m9so1371688qkl.4 for ; Sun, 10 Mar 2019 09:30:18 -0700 (PDT) MIME-Version: 1.0 From: Iain Buclaw Date: Sun, 10 Mar 2019 17:30:05 +0100 Message-ID: Subject: [PATCH PR d/88958] Committed fix for ICE in walk_aliased_vdefs_1 To: gcc-patches X-IsSubscribed: yes Hi, This patch merges the D front-end implementation with dmd upstream 0fc786f49, fixing PR d/88958. Bootstrapped and regression tested on x86_64-linux-gnu. Committed to trunk as r269557. diff --git a/gcc/d/dmd/MERGE b/gcc/d/dmd/MERGE index 3f416dbfb7b..98bf8254554 100644 --- a/gcc/d/dmd/MERGE +++ b/gcc/d/dmd/MERGE @@ -1,4 +1,4 @@ -d517c0e6a10b548f44d82b71b3c079663cb94f8e +0fc786f4908aa6bdd4220af87995333b1f24c3d7 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/expressionsem.c b/gcc/d/dmd/expressionsem.c index 3fd5c1fa33f..bcc1ac9ed2f 100644 --- a/gcc/d/dmd/expressionsem.c +++ b/gcc/d/dmd/expressionsem.c @@ -102,6 +102,12 @@ static bool preFunctionParameters(Scope *sc, Expressions *exps) arg = new ErrorExp(); err = true; } + else if (arg->type->toBasetype()->ty == Tfunction) + { + arg->error("cannot pass type %s as a function argument", arg->toChars()); + arg = new ErrorExp(); + err = true; + } else if (checkNonAssignmentArrayOp(arg)) { arg = new ErrorExp(); diff --git a/gcc/testsuite/gdc.test/fail_compilation/test19608.d b/gcc/testsuite/gdc.test/fail_compilation/test19608.d new file mode 100644 index 00000000000..cea84a6bd50 --- /dev/null +++ b/gcc/testsuite/gdc.test/fail_compilation/test19608.d @@ -0,0 +1,16 @@ +// https://issues.dlang.org/show_bug.cgi?id=19608 +/* +TEST_OUTPUT: +--- +fail_compilation/test19608.d(15): Error: cannot pass function `*& f` as a function argument +--- +*/ +import core.stdc.stdarg; + +void f(int) {} +void g(...) {} +void h() +{ + g(&f); // OK, function address + g(*&f); // ICE -> Error +}