From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 62608 invoked by alias); 15 May 2017 19:36:59 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 62552 invoked by uid 89); 15 May 2017 19:36:58 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-9.3 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_2,GIT_PATCH_3,KAM_ASCII_DIVIDERS,KAM_LAZY_DOMAIN_SECURITY,RP_MATCHES_RCVD autolearn=ham version=3.3.2 spammy=knd, H*MI:washington, watch 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; Mon, 15 May 2017 19:36:55 +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 v4FJavL9054514 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Mon, 15 May 2017 12:36:57 -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 v4FJavZp054513; Mon, 15 May 2017 12:36:57 -0700 (PDT) (envelope-from sgk) Date: Mon, 15 May 2017 19:38:00 -0000 From: Steve Kargl To: fortran@gcc.gnu.org, gcc-patches@gcc.gnu.org Subject: [PATCH, committed] Fix PR fortran/80752 Message-ID: <20170515193657.GA54481@troutmask.apl.washington.edu> Reply-To: sgk@troutmask.apl.washington.edu MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="UugvWAfsgieZRqgk" Content-Disposition: inline User-Agent: Mutt/1.7.2 (2016-11-26) X-SW-Source: 2017-05/txt/msg01212.txt.bz2 --UugvWAfsgieZRqgk Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-length: 425 I've committed the attached patch. 2017-05-15 Steven G. Kargl PR fortran/80752 * expr.c (gfc_generate_initializer): If type conversion fails, check for error and return NULL. 2017-05-15 Steven G. Kargl PR fortran/80752 gfortran.dg/pr80752.f90: New test. -- Steve 20170425 https://www.youtube.com/watch?v=VWUpyCsUKR4 20161221 https://www.youtube.com/watch?v=IbCHE-hONow --UugvWAfsgieZRqgk Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="pr80752.diff" Content-length: 1259 Index: gcc/fortran/expr.c =================================================================== --- gcc/fortran/expr.c (revision 248066) +++ gcc/fortran/expr.c (working copy) @@ -4395,7 +4395,12 @@ gfc_generate_initializer (gfc_typespec * if ((comp->ts.type != tmp->ts.type || comp->ts.kind != tmp->ts.kind) && !comp->attr.pointer && !comp->attr.proc_pointer) - gfc_convert_type_warn (ctor->expr, &comp->ts, 2, false); + { + bool val; + val = gfc_convert_type_warn (ctor->expr, &comp->ts, 1, false); + if (val == false) + return NULL; + } } if (comp->attr.allocatable Index: gcc/testsuite/gfortran.dg/pr80752.f90 =================================================================== --- gcc/testsuite/gfortran.dg/pr80752.f90 (nonexistent) +++ gcc/testsuite/gfortran.dg/pr80752.f90 (working copy) @@ -0,0 +1,20 @@ +! { dg-do compile } +! PR fortran/80752 +module exchange_utils + + implicit none + + integer, parameter, public :: knd = 8 + + type, private :: a + logical :: add_vs98 = 0.0_knd ! { dg-error "Can't convert" } + end type a + + type, private :: x_param_t + type(a) :: m05_m06 + end type x_param_t + + type(x_param_t), public, save :: x_param + +end module exchange_utils + --UugvWAfsgieZRqgk--