From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 109200 invoked by alias); 21 Mar 2018 01:29:42 -0000 Mailing-List: contact fortran-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: fortran-owner@gcc.gnu.org Received: (qmail 109175 invoked by uid 89); 21 Mar 2018 01:29:41 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-9.4 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_2,GIT_PATCH_3,KAM_ASCII_DIVIDERS,KAM_LAZY_DOMAIN_SECURITY,T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 spammy=H*MI:edu X-Spam-User: qpsmtpd, 2 recipients X-HELO: troutmask.apl.washington.edu Received: from troutmask.apl.washington.edu (HELO troutmask.apl.washington.edu) (128.95.76.21) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 21 Mar 2018 01:29:40 +0000 Received: from troutmask.apl.washington.edu (localhost [127.0.0.1]) by troutmask.apl.washington.edu (8.15.2/8.15.2) with ESMTPS id w2L1TclC070407 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Tue, 20 Mar 2018 18:29:38 -0700 (PDT) (envelope-from sgk@troutmask.apl.washington.edu) Received: (from sgk@localhost) by troutmask.apl.washington.edu (8.15.2/8.15.2/Submit) id w2L1TcFJ070406; Tue, 20 Mar 2018 18:29:38 -0700 (PDT) (envelope-from sgk) Date: Wed, 21 Mar 2018 01:29:00 -0000 From: Steve Kargl To: fortran@gcc.gnu.org, gcc-patches@gcc.gnu.org Subject: [Committed] PR fortran/85001 -- Fix a non non-null pointer issue Message-ID: <20180321012938.GA70373@troutmask.apl.washington.edu> Reply-To: sgk@troutmask.apl.washington.edu MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.9.2 (2017-12-15) X-IsSubscribed: yes X-SW-Source: 2018-03/txt/msg00108.txt.bz2 The following patch fixes an assign of a valid pointer to to pointer, but what should have been assigned is NULL; 2018-03-20 Steven G. Kargl PR fortran/85001 * interface.c (symbol_rank): Remove bogus null pointer check that crept in when translating a ternary operator into an if-else constructor. 2018-03-20 Steven G. Kargl PR fortran/85001 * gfortran.dg/interface_41.f90: New test. Index: gcc/fortran/interface.c =================================================================== --- gcc/fortran/interface.c (revision 258646) +++ gcc/fortran/interface.c (working copy) @@ -1268,7 +1268,7 @@ symbol_rank (gfc_symbol *sym) { gfc_array_spec *as = NULL; - if (sym->ts.type == BT_CLASS && CLASS_DATA (sym) && CLASS_DATA (sym)->as) + if (sym->ts.type == BT_CLASS && CLASS_DATA (sym)) as = CLASS_DATA (sym)->as; else as = sym->as; Index: gcc/testsuite/gfortran.dg/interface_41.f90 =================================================================== --- gcc/testsuite/gfortran.dg/interface_41.f90 (nonexistent) +++ gcc/testsuite/gfortran.dg/interface_41.f90 (working copy) @@ -0,0 +1,19 @@ +! { dg-do compile } +! PR fortran/85001 +! Contributed by Gerhard Steinmetz. +program p + type t + end type + call s +contains + real function f(x) + class(t) :: x + dimension :: x(:) + f = 1.0 + end + subroutine s + type(t) :: x(2) + real :: z + z = f(x) ! { dg-error "Rank mismatch in argument" } + end +end -- Steve