From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 119978 invoked by alias); 24 Oct 2015 17:51:03 -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 119953 invoked by uid 89); 24 Oct 2015 17:51:02 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.0 required=5.0 tests=AWL,BAYES_00,KAM_ASCII_DIVIDERS,KAM_LAZY_DOMAIN_SECURITY,RP_MATCHES_RCVD autolearn=no version=3.3.2 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 (AES256-GCM-SHA384 encrypted) ESMTPS; Sat, 24 Oct 2015 17:51:01 +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 t9OHoxLg028273 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Sat, 24 Oct 2015 10:50:59 -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 t9OHox56028272; Sat, 24 Oct 2015 10:50:59 -0700 (PDT) (envelope-from sgk) Date: Sat, 24 Oct 2015 17:51:00 -0000 From: Steve Kargl To: fortran@gcc.gnu.org, gcc-patches@gcc.gnu.org Subject: [PATCH] PR fortran/68054 -- PROTECTED in modules only Message-ID: <20151024175059.GA28261@troutmask.apl.washington.edu> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="G4iJoqBmSsgzjUCe" Content-Disposition: inline User-Agent: Mutt/1.5.24 (2015-08-30) X-IsSubscribed: yes X-SW-Source: 2015-10/txt/msg00122.txt.bz2 --G4iJoqBmSsgzjUCe Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-length: 402 The attached patch fixes an ICE that occurs when gfortran is not expecting a PROTECTED attribute. Built and tested on x86_64-*-freebsd. OK to commit? 2015-10-24 Steven G. Kargl PR fortran/68054 * decl.c (match_attr_spec): PROTECTED can only be a module. 2015-10-24 Steven G. Kargl PR fortran/68054 * gfortran.dg/pr68054.f90: New test. -- Steve --G4iJoqBmSsgzjUCe Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="pr68054.diff" Content-length: 1045 Index: gcc/fortran/decl.c =================================================================== --- gcc/fortran/decl.c (revision 229288) +++ gcc/fortran/decl.c (working copy) @@ -3957,7 +3957,9 @@ match_attr_spec (void) break; case DECL_PROTECTED: - if (gfc_current_ns->proc_name->attr.flavor != FL_MODULE) + if (gfc_current_state () != COMP_MODULE + || (gfc_current_ns->proc_name + && gfc_current_ns->proc_name->attr.flavor != FL_MODULE)) { gfc_error ("PROTECTED at %C only allowed in specification " "part of a module"); Index: gcc/testsuite/gfortran.dg/pr68054.f90 =================================================================== --- gcc/testsuite/gfortran.dg/pr68054.f90 (revision 0) +++ gcc/testsuite/gfortran.dg/pr68054.f90 (working copy) @@ -0,0 +1,8 @@ +! { dg-do compile } +! PR fortran/68054 +! Original code contributed by Gerhard Steinmetz +! gerhard dot steinmetz dot fortran at t-online dot de +! +!program p + real, protected :: x ! { dg-error "only allowed in specification" } +end --G4iJoqBmSsgzjUCe--