From patchwork Mon Feb 2 10:03:22 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andre Vehreschild X-Patchwork-Id: 435406 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org 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 4B79B14017D for ; Mon, 2 Feb 2015 21:04:55 +1100 (AEDT) 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:cc:subject:message-id:in-reply-to:references :mime-version:content-type; q=dns; s=default; b=hjfRJTE37dEIEZkx N+oMUtxSoqt4kelBVir0VwhL/GkL3xRlh8l1JOssR14xRHfTA4KD9dBGQ1j903Fq DUwVv3PjhLmGFowwVnnEdH1PqFWrieAZv3ySBF5wJ9QOOlfmW/Zb4W7LdFfnkbHS 3oJdxdxvcuyBhTWQZZXWYlYTwLk= 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:cc:subject:message-id:in-reply-to:references :mime-version:content-type; s=default; bh=4lGDFVJ9fdYyCANKcC2ZVM UKQ1M=; b=aom0wKf/+6xBtNQdn07Bd6PXZJhbk+5DprbxMuSwIcGlwPBMSbge69 QSep8SyHGrTh19F60DjBp7o3+DeyXp0U6uQPwu0a667WMJpKpmg7f1HXCYGQywCk 61mewJOmTztn4y3nDxrWxS+eUkXdVmJvLlZwEOsCvWoY59RBpOVuc= Received: (qmail 13977 invoked by alias); 2 Feb 2015 10:03:31 -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 13957 invoked by uid 89); 2 Feb 2015 10:03:31 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.4 required=5.0 tests=AWL, BAYES_00, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.2 X-Spam-User: qpsmtpd, 2 recipients X-HELO: mout.gmx.net Received: from mout.gmx.net (HELO mout.gmx.net) (212.227.17.22) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Mon, 02 Feb 2015 10:03:29 +0000 Received: from vepi2 ([84.63.49.248]) by mail.gmx.com (mrgmx101) with ESMTPSA (Nemesis) id 0LeRKD-1XspiT0FIb-00qDTa; Mon, 02 Feb 2015 11:03:24 +0100 Date: Mon, 2 Feb 2015 11:03:22 +0100 From: Andre Vehreschild To: Jerry DeLisle Cc: GCC-Fortran-ML , GCC-Patches-ML Subject: Re: [Patch, fortran] Cosmetics: Dup. code removal, indent fix, typo fix. Message-ID: <20150202110322.06018c9b@vepi2> In-Reply-To: <54CCF7A4.4060006@charter.net> References: <20150130131029.3b61ba87@vepi2> <54CCF7A4.4060006@charter.net> MIME-Version: 1.0 X-UI-Out-Filterresults: notjunk:1; Hi Jerry, thanks for the review. Committed as r220345. Regards, Andre On Sat, 31 Jan 2015 07:41:24 -0800 Jerry DeLisle wrote: > On 01/30/2015 04:10 AM, Andre Vehreschild wrote: > > Hi all, > > > > I fear this fix is not so obvious in one location, I therefore ask for a > > review. The attached patch fixes: > > > > - a duplicate code fragment (possibly due to merged twice), > > - the indentation in the trans-expr.c block (in my first patch), and > > - a typo on the datatype-size to create for the charlen. > > > > The length of a char-array is stored as a 4-byte BT_INTEGER. Due to a typo a > > 1-byte BT_INTEGER was requested. The patch fixes this. I know this patch > > mixes several trivial issues. Should I do separate patches for each of > > them, or what is the most desirable method? > > > > Cosmetic things are OK to throw in the mix as long as you have the Changelog. > Duplicate code removal is just about as obvious as one can get. No need for > separate patches. > > > Bootstraps and regtests ok on x86_64-linux-gnu/FC20. > > > > I have learned the hard way that if you forget the testing even on trivial > things it can byte you. OK to commit! Thanks. Index: gcc/fortran/trans-decl.c =================================================================== --- gcc/fortran/trans-decl.c (Revision 220344) +++ gcc/fortran/trans-decl.c (Arbeitskopie) @@ -1443,8 +1443,6 @@ if (sym->ts.type == BT_CLASS && sym->backend_decl) GFC_DECL_CLASS(sym->backend_decl) = 1; - if (sym->ts.type == BT_CLASS && sym->backend_decl) - GFC_DECL_CLASS(sym->backend_decl) = 1; return sym->backend_decl; } Index: gcc/fortran/trans-expr.c =================================================================== --- gcc/fortran/trans-expr.c (Revision 220344) +++ gcc/fortran/trans-expr.c (Arbeitskopie) @@ -660,26 +660,26 @@ expression can be evaluated to a constant one. */ else { - /* Try to simplify the expression. */ - gfc_simplify_expr (e, 0); - if (e->expr_type == EXPR_CONSTANT && !e->ts.u.cl->resolved) - { - /* Amazingly all data is present to compute the length of a - constant string, but the expression is not yet there. */ - e->ts.u.cl->length = gfc_get_constant_expr (BT_INTEGER, 1, - &e->where); - mpz_set_ui (e->ts.u.cl->length->value.integer, - e->value.character.length); - gfc_conv_const_charlen (e->ts.u.cl); - e->ts.u.cl->resolved = 1; - gfc_add_modify (&parmse->pre, ctree, e->ts.u.cl->backend_decl); - } - else - { - gfc_error ("Can't compute the length of the char array at %L.", - &e->where); - } - } + /* Try to simplify the expression. */ + gfc_simplify_expr (e, 0); + if (e->expr_type == EXPR_CONSTANT && !e->ts.u.cl->resolved) + { + /* Amazingly all data is present to compute the length of a + constant string, but the expression is not yet there. */ + e->ts.u.cl->length = gfc_get_constant_expr (BT_INTEGER, 4, + &e->where); + mpz_set_ui (e->ts.u.cl->length->value.integer, + e->value.character.length); + gfc_conv_const_charlen (e->ts.u.cl); + e->ts.u.cl->resolved = 1; + gfc_add_modify (&parmse->pre, ctree, e->ts.u.cl->backend_decl); + } + else + { + gfc_error ("Can't compute the length of the char array at %L.", + &e->where); + } + } } /* Pass the address of the class object. */ parmse->expr = gfc_build_addr_expr (NULL_TREE, var); Index: gcc/fortran/ChangeLog =================================================================== --- gcc/fortran/ChangeLog (Revision 220344) +++ gcc/fortran/ChangeLog (Arbeitskopie) @@ -1,3 +1,10 @@ + +2015-01-30 Andre Vehreschild + + * trans-decl.c (gfc_get_symbol_decl): Removed duplicate code. + * trans-expr.c (gfc_conv_intrinsic_to_class): Fixed indentation. + Fixed datatype of charlen to be a 32-bit int. + 2015-02-01 Joseph Myers * error.c (gfc_warning (const char *, ...), gfc_warning_now (const