From patchwork Sun Oct 30 16:32:52 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Koenig X-Patchwork-Id: 80077 Delivered-To: patch@linaro.org Received: by 10.140.97.247 with SMTP id m110csp2079295qge; Sun, 30 Oct 2016 09:33:23 -0700 (PDT) X-Received: by 10.98.211.147 with SMTP id z19mr42153227pfk.149.1477845203150; Sun, 30 Oct 2016 09:33:23 -0700 (PDT) Return-Path: Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id z14si21171267pgo.126.2016.10.30.09.33.22 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 30 Oct 2016 09:33:23 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-return-439901-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) client-ip=209.132.180.131; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org; spf=pass (google.com: domain of gcc-patches-return-439901-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=gcc-patches-return-439901-patch=linaro.org@gcc.gnu.org DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:to :from:subject:message-id:date:mime-version:content-type; q=dns; s=default; b=od+7O5WLv8HNVyiJ5/Zpa5hGOEuQff3TYOqdsL+ZTiSkoYuHle klNcpXccw7eEC5s0hDH2NQpDAmMIximEGAfcD6UiRqJxSRJ+PcOAsUEJWhp28OeN rpMMfab6HTX1zXs1E1aAiqEtGgNjGZYrvXobD9yPIu3vZzxoVl7+KeptM= 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:to :from:subject:message-id:date:mime-version:content-type; s= default; bh=k4XXEmIgiYlTbPJHPbz8Jg0kjE8=; b=rjyIGt0lS7/j9mgiiTwJ ltai/GF2IbLb/KkJhc8qClcbI27M5OXhrkpSNSYFZk1tEfFqX6w9i66+iA/Q6Ye8 RIc3z6/FVYRYOAcvI5mw9wtNfJKjeU49vHQ5sE5G2Xjq+QIfSN3hM4oq4eSkSKY+ hCzDQ4eS0V8BYFQYOLWWzPc= Received: (qmail 47567 invoked by alias); 30 Oct 2016 16:33:10 -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 47545 invoked by uid 89); 30 Oct 2016 16:33:09 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=0.7 required=5.0 tests=AWL, BAYES_50, KAM_ASCII_DIVIDERS, KAM_LAZY_DOMAIN_SECURITY, RCVD_IN_DNSWL_LOW, RP_MATCHES_RCVD autolearn=ham version=3.3.2 spammy=H*Ad:U*tkoenig, gfc_expr, primaryc, gfc_pop_error X-Spam-User: qpsmtpd, 2 recipients X-HELO: cc-smtpout2.netcologne.de Received: from cc-smtpout2.netcologne.de (HELO cc-smtpout2.netcologne.de) (89.1.8.212) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sun, 30 Oct 2016 16:32:59 +0000 Received: from cc-smtpin2.netcologne.de (cc-smtpin2.netcologne.de [89.1.8.202]) by cc-smtpout2.netcologne.de (Postfix) with ESMTP id 819731265A; Sun, 30 Oct 2016 17:32:54 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by cc-smtpin2.netcologne.de (Postfix) with ESMTP id 746B111D79; Sun, 30 Oct 2016 17:32:54 +0100 (CET) Received: from [78.35.155.139] (helo=cc-smtpin2.netcologne.de) by localhost with ESMTP (eXpurgate 4.1.9) (envelope-from ) id 581620b6-0c00-7f0000012729-7f000001bb44-1 for ; Sun, 30 Oct 2016 17:32:54 +0100 Received: from [192.168.178.20] (xdsl-78-35-155-139.netcologne.de [78.35.155.139]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by cc-smtpin2.netcologne.de (Postfix) with ESMTPSA; Sun, 30 Oct 2016 17:32:53 +0100 (CET) To: "fortran@gcc.gnu.org" , gcc-patches From: Thomas Koenig Subject: [patch, fortran] Fix PR 67219, erroneous warning Message-ID: <23b20f03-ca1f-defc-c5de-c3bd09524bf0@netcologne.de> Date: Sun, 30 Oct 2016 17:32:52 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 MIME-Version: 1.0 Hello world, the regression in question was caused by issuing a conversion warning for a complex constant too early, when the statement would be rejected later. The solution is to throw away the warning if we do not find that comma. Regression-tested. OK for trunk and 6-branch? Regards Thomas 2016-10-30 Thomas Koenig PR fortran/67219 * arith.c (gfc_int2real): Change gfc_warning_now to gfc_warning. * primary.c (match_complex_constant): If there is no comma, throw away any warning which might have been issued by gfc_int2real. 2016-10-30 Thomas Koenig PR fortran/67219 * gfortran.dg/pr67219.f90: New test. Index: arith.c =================================================================== --- arith.c (Revision 241590) +++ arith.c (Arbeitskopie) @@ -2072,11 +2072,11 @@ gfc_int2real (gfc_expr *src, int kind) if (warn_conversion && wprecision_int_real (src->value.integer, result->value.real)) - gfc_warning_now (OPT_Wconversion, "Change of value in conversion " - "from %qs to %qs at %L", - gfc_typename (&src->ts), - gfc_typename (&result->ts), - &src->where); + gfc_warning (OPT_Wconversion, "Change of value in conversion " + "from %qs to %qs at %L", + gfc_typename (&src->ts), + gfc_typename (&result->ts), + &src->where); return result; } Index: primary.c =================================================================== --- primary.c (Revision 241590) +++ primary.c (Arbeitskopie) @@ -1353,6 +1353,10 @@ match_complex_constant (gfc_expr **result) if (gfc_match_char (',') == MATCH_NO) { + /* It is possible that gfc_int2real issued a warning when + converting an integer to real. Throw this away here. */ + + gfc_clear_warning (); gfc_pop_error (&old_error); m = MATCH_NO; goto cleanup;