From patchwork Tue Jun 12 18:00:08 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve Kargl X-Patchwork-Id: 928444 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-479558-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=troutmask.apl.washington.edu Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="RSwf3ose"; dkim-atps=neutral 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 414yNm3RKbz9s2g for ; Wed, 13 Jun 2018 04:00:54 +1000 (AEST) 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=KaostAAZGDMeyB6BwOoAYjQufgUxGRWabpjxN+9ICcM 48oGZqeqJqqzrATUU6SbhE72fdSLWxUnYBOB8fuCxh7IOi4CxYmBDe+zB6cvCV3+ UpHRHEvekrBpGeUG48Ai219sCmN9wLwGGbQr14iNvpq8cnvYwrDYaz8cpVeQ8QVU = 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=F/JaH+rxXOWJBp99vGTITKuL0z4=; b=RSwf3oseGztzuee6X 2GM27nxoGShFK+GG4Yun2GypRgpAZ5CEpztd9S931GNtuf+F26bNZxoQhtS4INZk oZamKIZnv0pgxuik5ZcND22mzYFM8M7qeAVrsmnKrQp8jahrAfZyG3KjPbDFQky2 KFNd3yUWQPA+s6/lNK8MJsNv0U= Received: (qmail 86771 invoked by alias); 12 Jun 2018 18:00:45 -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 86561 invoked by uid 89); 12 Jun 2018 18:00:28 -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 autolearn=ham version=3.3.2 spammy=aid, locating, Statements, his 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; Tue, 12 Jun 2018 18:00:26 +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 w5CI08cR058170 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Tue, 12 Jun 2018 11:00:08 -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 w5CI08bQ058058; Tue, 12 Jun 2018 11:00:08 -0700 (PDT) (envelope-from sgk) Date: Tue, 12 Jun 2018 11:00:08 -0700 From: Steve Kargl To: fortran@gcc.gnu.org, gcc-patches@gcc.gnu.org Subject: [Committed] PR fortran/44491 -- Select non-NULL locus Message-ID: <20180612180008.GA73720@troutmask.apl.washington.edu> Reply-To: sgk@troutmask.apl.washington.edu MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.9.2 (2017-12-15) The attached patch has been committed to trunk after regression testing. Two loci are available for the error messages. If the first locus is NULL, then it uses the second one to report the error. In the audit trail of the PR manu@ suggested removing the assert() that caused the ICE. His patch tested for a NULL locus, and simply reported UNKNOWN LOCATION in the error message. I find the ICE to be an aid in locating where gfortran goes sideways, so I've left the assert() in place. Index: gcc/fortran/expr.c =================================================================== --- gcc/fortran/expr.c (revision 261376) +++ gcc/fortran/expr.c (working copy) @@ -3414,6 +3414,8 @@ gfc_check_assign (gfc_expr *lvalue, gfc_expr *rvalue, /* Only DATA Statements come here. */ if (!conform) { + locus *where; + /* Numeric can be converted to any other numeric. And Hollerith can be converted to any other type. */ if ((gfc_numeric_ts (&lvalue->ts) && gfc_numeric_ts (&rvalue->ts)) @@ -3423,8 +3425,9 @@ gfc_check_assign (gfc_expr *lvalue, gfc_expr *rvalue, if (lvalue->ts.type == BT_LOGICAL && rvalue->ts.type == BT_LOGICAL) return true; + where = lvalue->where.lb ? &lvalue->where : &rvalue->where; gfc_error ("Incompatible types in DATA statement at %L; attempted " - "conversion of %s to %s", &lvalue->where, + "conversion of %s to %s", where, gfc_typename (&rvalue->ts), gfc_typename (&lvalue->ts)); return false; Index: gcc/testsuite/gfortran.dg/pr44491.f90 =================================================================== --- gcc/testsuite/gfortran.dg/pr44491.f90 (nonexistent) +++ gcc/testsuite/gfortran.dg/pr44491.f90 (working copy) @@ -0,0 +1,4 @@ +! { dg-do compile } +! PR fortran/44491 + character*2 escape /z'1B'/ ! { dg-error "Incompatible types in DATA" } + end