From patchwork Fri Dec 2 13:37:24 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Janus Weil X-Patchwork-Id: 701966 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org 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 3tVZw83KHjz9t1H for ; Sat, 3 Dec 2016 00:37:44 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="r1cKuf3N"; dkim-atps=neutral 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=mwbJHn6vplKDNJLEapHeNh0GF3qpMClbrFpMFM0do3EoYb 6WJcYeAYITMy6kMtv8Y5ZIp2zlr/JPzALxj6CHf8l9w/g/a6VK+jEts297UKYe8R UvXpVFnP+tZxKJV8vjrG2Bca+AHhZDh28VO+fySnmQ0udC8PVmSK2mhYz8Acw= 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=uKGelnBSBvVOl3z88qZLrcsHO9Q=; b=r1cKuf3NBam4twZeYHPW fxUyiZayADpBku46i3U3aGax2sxO6tKPb8bRoDIQS8aI19pAIxt5KaI2Q0m78pII J31CtWpoiKGBy9rPQbQmxbX9Boegg8Ow629UeELch2CoRfgd/rmF/Rkih2M7UCxc kneJ5kw9A1WSt3QYQSgqDcM= Received: (qmail 101330 invoked by alias); 2 Dec 2016 13:37: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 101308 invoked by uid 89); 2 Dec 2016 13:37:33 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.1 required=5.0 tests=AWL, BAYES_00, FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, RCVD_IN_SORBS_SPAM, SPF_PASS autolearn=no version=3.3.2 spammy=Reject, Hx-languages-length:2163, extends, 243176 X-Spam-User: qpsmtpd, 2 recipients X-HELO: mail-yw0-f195.google.com Received: from mail-yw0-f195.google.com (HELO mail-yw0-f195.google.com) (209.85.161.195) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 02 Dec 2016 13:37:26 +0000 Received: by mail-yw0-f195.google.com with SMTP id b66so21625658ywh.2; Fri, 02 Dec 2016 05:37:26 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:sender:from:date:message-id:subject :to; bh=ZOvW0+VcLp9GHFI958TYx8XmOTtX8tWYJF0wyLmbW4U=; b=d55O7x05GFq+2yKKahxmUKXmJL8iPOhNyxGHJdB8f7CZTzMPssiGlozJ25DOCvLKhc gx8YifVo/xRUtiPm0vxBdnH31weYHQkeEB7h9wHcM82cI6ROh5kP0ChpxQIxHyt0o6CF xMoQsGtrlQZlV68vXjhOYhrtxLkex0Zw54DL8BKPhiTHT5U6EcH6pHG2NDwdy6dhOspr 04JQyOvJ/5UebitxNN7e4fcTykAChqg7AoOn0zfrZWO/dvTYKff/4fN+yw08WSiqovvP felRjuj2T4Nb7RJVsfY3RkYE9WkvnYx2GONZHuMPIlFuABInxQZtkDuPXQYVVMDy2ihA grwg== X-Gm-Message-State: AKaTC01SNHFScBXz/9vqjcMzOeJVyYNc12BFefRP437DKH1UMt/2fJybd5mmjOy+1d8YFvjuDQixIMP0E9EddQ== X-Received: by 10.129.132.77 with SMTP id u74mr44623661ywf.177.1480685844879; Fri, 02 Dec 2016 05:37:24 -0800 (PST) MIME-Version: 1.0 Received: by 10.129.51.145 with HTTP; Fri, 2 Dec 2016 05:37:24 -0800 (PST) From: Janus Weil Date: Fri, 2 Dec 2016 14:37:24 +0100 Message-ID: Subject: [Patch, Fortran, OOP] PR 43207: [OOP] invalid (pointer) assignment to and from abstract non-polymorphic expressions To: gfortran , gcc-patches Hi all, the attached patch fixes the PR in the subject line by introducing a new check to reject invalid code. It's a slight update of an old patch that I posted in the PR quite some time ago, using somewhat tighter checking to avoid side effects on the testsuite. Regtests cleanly on x86_64-linux-gnu. Ok for trunk? Cheers, Janus 2016-12-02 Janus Weil PR fortran/43207 * primary.c (gfc_match_varspec): Reject nonpolymorphic references to abstract types. 2016-12-02 Janus Weil PR fortran/43207 * gfortran.dg/abstract_type_9.f90: New test case. Index: gcc/fortran/primary.c =================================================================== --- gcc/fortran/primary.c (revision 243176) +++ gcc/fortran/primary.c (working copy) @@ -2222,7 +2222,15 @@ check_substring: } } - /* F2008, C727. */ + /* F08:C611. */ + if (primary->ts.type == BT_DERIVED && primary->ref + && primary->ts.u.derived && primary->ts.u.derived->attr.abstract) + { + gfc_error ("Nonpolymorphic reference to abstract type at %C"); + return MATCH_ERROR; + } + + /* F08:C727. */ if (primary->expr_type == EXPR_PPC && gfc_is_coindexed (primary)) { gfc_error ("Coindexed procedure-pointer component at %C");