From patchwork Tue Jan 13 16:24:30 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jakub Jelinek X-Patchwork-Id: 428523 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 CA25214014D for ; Wed, 14 Jan 2015 03:24:45 +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:date :from:to:subject:message-id:reply-to:mime-version:content-type; q=dns; s=default; b=uMfmfh0kRlkvpGBzoNgKL4YZvORyGpHbriYkVXxzvFM +Ox6by9Mq0HHAe/5Sc3qwg0Ef5KZ8wGbkRnJEnH5m4V4zUkLRcBTFp0qSo1j0tpp AlrOR/+0T+HbjDKiLxyx6qtGTxV5MqQ29vXJCR3aBv3Qo+Gsyh17+/MNOSMYlWAA = 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:date :from:to:subject:message-id:reply-to:mime-version:content-type; s=default; bh=mrRfccg99og8jCwOiiJDUPPYG70=; b=F/Z4DZwhhEIGshnwz R1QTMgkY1uFwQ7DfdzLWpw0UdzTOF42VLHf2ySHsYkgrr31or/rNjpxjiObVI0BI 5FGwUDf/ZY3CGfJEcQ/mdQS41r/4p+ZdNin+DWdl2dmi7/xeb/iqMxFkF0ZfmQCL HUPmCRyVZw9GMD1C7ufQESr8f8= Received: (qmail 4961 invoked by alias); 13 Jan 2015 16:24:38 -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 4943 invoked by uid 89); 13 Jan 2015 16:24:37 -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, SPF_HELO_PASS, SPF_PASS, T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-Spam-User: qpsmtpd, 2 recipients X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Tue, 13 Jan 2015 16:24:35 +0000 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id t0DGOY1B006159 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 13 Jan 2015 11:24:34 -0500 Received: from tucnak.zalov.cz (ovpn-116-64.ams2.redhat.com [10.36.116.64]) by int-mx13.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t0DGOWwH029731 (version=TLSv1/SSLv3 cipher=AES128-GCM-SHA256 bits=128 verify=NO); Tue, 13 Jan 2015 11:24:33 -0500 Received: from tucnak.zalov.cz (localhost [127.0.0.1]) by tucnak.zalov.cz (8.14.9/8.14.9) with ESMTP id t0DGOVgt029767; Tue, 13 Jan 2015 17:24:31 +0100 Received: (from jakub@localhost) by tucnak.zalov.cz (8.14.9/8.14.9/Submit) id t0DGOUuV029766; Tue, 13 Jan 2015 17:24:30 +0100 Date: Tue, 13 Jan 2015 17:24:30 +0100 From: Jakub Jelinek To: gcc-patches@gcc.gnu.org, fortran@gcc.gnu.org Subject: [PATCH] Don't set TREE_READONLY on dummy args with VALUE attr (PR fortran/64528) Message-ID: <20150113162430.GG1405@tucnak.redhat.com> Reply-To: Jakub Jelinek MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.23 (2014-03-12) X-IsSubscribed: yes Hi! With VALUE attr, the PARM_DECLs hold the values and thus are (usually) not read-only, therefore telling the middle-end they are read-only leads to invalid IL. Fixed thusly, bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk? 2015-01-13 Jakub Jelinek PR fortran/64528 * trans-decl.c (create_function_arglist): Don't set TREE_READONLY on dummy args with VALUE attribute. * gfortran.dg/pr64528.f90: New test. Jakub --- gcc/fortran/trans-decl.c.jj 2015-01-09 21:59:47.000000000 +0100 +++ gcc/fortran/trans-decl.c 2015-01-13 14:24:22.342682352 +0100 @@ -2327,8 +2327,9 @@ create_function_arglist (gfc_symbol * sy /* Fill in arg stuff. */ DECL_CONTEXT (parm) = fndecl; DECL_ARG_TYPE (parm) = TREE_VALUE (typelist); - /* All implementation args are read-only. */ - TREE_READONLY (parm) = 1; + /* All implementation args except for VALUE are read-only. */ + if (!f->sym->attr.value) + TREE_READONLY (parm) = 1; if (POINTER_TYPE_P (type) && (!f->sym->attr.proc_pointer && f->sym->attr.flavor != FL_PROCEDURE)) --- gcc/testsuite/gfortran.dg/pr64528.f90.jj 2015-01-13 14:27:13.475650977 +0100 +++ gcc/testsuite/gfortran.dg/pr64528.f90 2015-01-13 14:26:46.000000000 +0100 @@ -0,0 +1,20 @@ +! PR fortran/64528 +! { dg-do compile } +! { dg-options "-O -fno-tree-dce -fno-tree-ccp" } + +program pr64528 + interface + subroutine foo(x) + integer, value :: x + end subroutine foo + end interface + integer :: x + x = 10 + call foo(x) + if(x .ne. 10) then + endif +end program pr64528 +subroutine foo(x) + integer, value :: x + x = 11 +end subroutine foo