From patchwork Wed Aug 19 14:53:47 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Mikael Morin X-Patchwork-Id: 508756 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 BF911140788 for ; Thu, 20 Aug 2015 00:54:18 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=rJrqPe0q; 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:from :subject:to:references:cc:message-id:date:mime-version :in-reply-to:content-type; q=dns; s=default; b=drgVIF8e8/ph2RmdH HcfgwCHKKeGtbOJYezYzuLnV+IrR3jnGQFpZ7lUlSqi9La9QC6QEWWNXjoVc60HV s669Cim/keepdQnshAqSBmmdy2JeO9k60wwrgj89ksHUrdAE3mMOt4ys7l3JEMPF kWgCs5+aMdoIIeMcIwwDEMCwF8= 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:from :subject:to:references:cc:message-id:date:mime-version :in-reply-to:content-type; s=default; bh=iowsfawHX3yKWbHmYG0BHN6 FudU=; b=rJrqPe0qshD2c57HyOBeaNsM0bMsWJCeyPwzMpb1zr22dlRm50zTVpq BYOAYQk4TzSCOUvvfklHhexO68skie5yVf1OoFdV+xWbMrk/ANhqMXbVDJugH1E2 HtV+Cmd2VRZvh8sGXkwI+k9O7PKuOnJ1VoTPPgrnKc+49D+2SavA= Received: (qmail 32182 invoked by alias); 19 Aug 2015 14:54: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 32160 invoked by uid 89); 19 Aug 2015 14:54:09 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.1 required=5.0 tests=AWL, BAYES_00, KAM_ASCII_DIVIDERS, RCVD_IN_DNSWL_LOW, RP_MATCHES_RCVD, SPF_PASS autolearn=ham version=3.3.2 X-Spam-User: qpsmtpd, 2 recipients X-HELO: smtp22.services.sfr.fr Received: from smtp22.services.sfr.fr (HELO smtp22.services.sfr.fr) (93.17.128.10) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-SHA encrypted) ESMTPS; Wed, 19 Aug 2015 14:54:03 +0000 Received: from filter.sfr.fr (localhost [86.72.15.180]) by msfrf2204.sfr.fr (SMTP Server) with ESMTP id 0CCB870000B1; Wed, 19 Aug 2015 16:54:01 +0200 (CEST) Authentication-Results: sfrmc.priv.atos.fr; dkim=none (no signature); dkim-adsp=none (no policy) header.from=mikael.morin@sfr.fr Received: from [192.168.1.85] (180.15.72.86.rev.sfr.net [86.72.15.180]) (using TLSv1 with cipher DHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) by msfrf2204.sfr.fr (SMTP Server) with ESMTP id B71B27000099; Wed, 19 Aug 2015 16:54:00 +0200 (CEST) X-SFR-UUID: 20150819145400750.B71B27000099@msfrf2204.sfr.fr From: Mikael Morin Subject: [fortran, committed] Forward port test generic_31.f90 from the 5 branch To: Paul Richard Thomas References: <55AE40B2.5070307@sfr.fr> <55B3D68D.5030203@sfr.fr> <55C33254.50508@sfr.fr> Cc: gcc-patches , gfortran Message-ID: <55D4987B.60307@sfr.fr> Date: Wed, 19 Aug 2015 16:53:47 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.1.0 MIME-Version: 1.0 In-Reply-To: X-IsSubscribed: yes Hello, I have forward-ported the test that justified backport of the pr66929 patch on the 5 branch: https://gcc.gnu.org/r227010 Mikael Index: gcc/testsuite/gfortran.dg/generic_31.f90 =================================================================== --- gcc/testsuite/gfortran.dg/generic_31.f90 (révision 0) +++ gcc/testsuite/gfortran.dg/generic_31.f90 (révision 227010) @@ -0,0 +1,35 @@ +! { dg-do run } +! +! PR fortran/66929 +! Check that the specific FIRST symbol is used for the call to FOO, +! so that the J argument is not assumed to be present + +module m + interface foo + module procedure first + end interface foo +contains + elemental function bar(j) result(r) + integer, intent(in), optional :: j + integer :: r, s(2) + ! We used to have NULL dereference here, in case of a missing J argument + s = foo(j, [3, 7]) + r = sum(s) + end function bar + elemental function first(i, j) result(r) + integer, intent(in), optional :: i + integer, intent(in) :: j + integer :: r + if (present(i)) then + r = i + else + r = -5 + end if + end function first +end module m +program p + use m + integer :: i + i = bar() + if (i /= -10) call abort +end program p Index: gcc/testsuite/ChangeLog =================================================================== --- gcc/testsuite/ChangeLog (révision 227009) +++ gcc/testsuite/ChangeLog (révision 227010) @@ -1,3 +1,8 @@ +2015-08-19 Mikael Morin + + PR fortran/66929 + * gfortran.dg/generic_31.f90: New. + 2015-08-19 Marek Polacek PR middle-end/67133