From patchwork Sat Dec 10 20:14:37 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tobias Burnus X-Patchwork-Id: 130561 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]) by ozlabs.org (Postfix) with SMTP id 9D6D8B6F9D for ; Sun, 11 Dec 2011 07:15:12 +1100 (EST) Received: (qmail 28334 invoked by alias); 10 Dec 2011 20:14:57 -0000 Received: (qmail 28318 invoked by uid 22791); 10 Dec 2011 20:14:55 -0000 X-SWARE-Spam-Status: No, hits=-1.8 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_NONE X-Spam-Check-By: sourceware.org Received: from mx02.qsc.de (HELO mx02.qsc.de) (213.148.130.14) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sat, 10 Dec 2011 20:14:39 +0000 Received: from [192.168.178.22] (port-92-204-110-169.dynamic.qsc.de [92.204.110.169]) by mx02.qsc.de (Postfix) with ESMTP id D7BB61DAF8; Sat, 10 Dec 2011 21:14:37 +0100 (CET) Message-ID: <4EE3BDAD.8030807@net-b.de> Date: Sat, 10 Dec 2011 21:14:37 +0100 From: Tobias Burnus User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:8.0) Gecko/20111105 Thunderbird/8.0 MIME-Version: 1.0 To: gcc patches , gfortran Subject: [Patch, Fortran, committed] Minor %(l)ld fix, move td.deferred check earlier 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 Hi all, I have committed (Rev. 182190) the attached patch as obvious. a) In one case, gfortran was using "%lld" with "long" instead of "%ld" (or instead of long long). The proper data type would be something like ptrdiff_t, long long or similar. However, different systems require different printfs, e.g. %lld or %I64. Thus, we use here "%ld" with "long" even though it might be only 32bits instead of 64bits (on systems with 64 bit pointers). (That's pattern is also used in trans-arrays.c and other files.) As the value is used for array shapes and similar out-of-bound failures, casting a 64bit value to 32bit for the run-time error message is usually possible without information loss. The proper solution would be to use something like TARGET_WIDE_INT_PRINT_DEC, which does not exist so far. (Only HOST_WIDE_INT_PRINT_DEC exists.) b) Mikael had ask me to move ts.deferred up in the file, which I didn't do in the original commit - but which I do now with this commit. Cf. http://gcc.gnu.org/ml/fortran/2011-12/msg00045.html Tobias Index: gcc/fortran/ChangeLog =================================================================== --- gcc/fortran/ChangeLog (Revision 182189) +++ gcc/fortran/ChangeLog (Arbeitskopie) @@ -1,3 +1,9 @@ +2011-12-10 Tobias Burnus + Kai Tietz + + * trans-decl.c (add_argument_checking): Check ts.deferred earlier. + * trans-intrinsic.c (gfc_conv_intrinsic_repeat): Use %ld with long. + 2011-12-08 Tobias Burnus PR fortran/50815 Index: gcc/fortran/trans-decl.c =================================================================== --- gcc/fortran/trans-decl.c (Revision 182189) +++ gcc/fortran/trans-decl.c (Arbeitskopie) @@ -4672,7 +4672,8 @@ add_argument_checking (stmtblock_t *block, gfc_sym gfc_formal_arglist *formal; for (formal = sym->formal; formal; formal = formal->next) - if (formal->sym && formal->sym->ts.type == BT_CHARACTER) + if (formal->sym && formal->sym->ts.type == BT_CHARACTER + && !fsym->ts.deferred) { enum tree_code comparison; tree cond; @@ -4695,10 +4696,8 @@ add_argument_checking (stmtblock_t *block, gfc_sym if the actual argument is (part of) an array, but only if the dummy argument is an array. (See "Sequence association" in Section 12.4.1.4 for F95 and 12.4.1.5 for F2003.) */ - if (fsym->ts.deferred) - continue; - else if (fsym->attr.pointer || fsym->attr.allocatable - || (fsym->as && fsym->as->type == AS_ASSUMED_SHAPE)) + if (fsym->attr.pointer || fsym->attr.allocatable + || (fsym->as && fsym->as->type == AS_ASSUMED_SHAPE)) { comparison = NE_EXPR; message = _("Actual string length does not match the declared one" Index: gcc/fortran/trans-intrinsic.c =================================================================== --- gcc/fortran/trans-intrinsic.c (Revision 182189) +++ gcc/fortran/trans-intrinsic.c (Arbeitskopie) @@ -6015,7 +6015,7 @@ gfc_conv_intrinsic_repeat (gfc_se * se, gfc_expr * build_int_cst (ncopies_type, 0)); gfc_trans_runtime_check (true, false, cond, &se->pre, &expr->where, "Argument NCOPIES of REPEAT intrinsic is negative " - "(its value is %lld)", + "(its value is %ld)", fold_convert (long_integer_type_node, ncopies)); /* If the source length is zero, any non negative value of NCOPIES