From patchwork Tue Aug 3 16:45:26 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Koenig X-Patchwork-Id: 60780 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 20A9AB70A5 for ; Wed, 4 Aug 2010 02:45:48 +1000 (EST) Received: (qmail 23247 invoked by alias); 3 Aug 2010 16:45:43 -0000 Received: (qmail 23210 invoked by uid 22791); 3 Aug 2010 16:45:39 -0000 X-SWARE-Spam-Status: No, hits=-1.0 required=5.0 tests=AWL, BAYES_00, KAM_STOCKGEN, RCVD_IN_DNSWL_NONE, T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from smtp6.netcologne.de (HELO smtp6.netcologne.de) (194.8.194.26) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 03 Aug 2010 16:45:30 +0000 Received: from [192.168.0.196] (xdsl-213-168-110-73.netcologne.de [213.168.110.73]) by smtp6.netcologne.de (Postfix) with ESMTP id 4A5572A05A7; Tue, 3 Aug 2010 18:45:27 +0200 (CEST) Subject: [patch, Fortran] Fix dependency checking regression for 64-bit From: Thomas Koenig To: fortran@gcc.gnu.org Cc: gcc-patches@gcc.gnu.org Date: Tue, 03 Aug 2010 18:45:26 +0200 Message-ID: <1280853926.25237.8.camel@linux-fd1f.site> Mime-Version: 1.0 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 Hello world, the attached patch fixes dependency checking for 64-bit systems. What used to happen was that the second and third expressions for indices were converted to 8-byte integers, but not the first one. This caused gfc_dep_compare_expr to fail. Incidentially, it worked with -m32. The non-conversion of the first expression was introduced some way back (the test case works for gfortran-4.4.1) so this is indeed a regression. Regression-tested on x86_64-unknown-linux-gnu. OK? Also OK for 4.5 if we need it? (I haven't checked yet). Thomas 2010-08-03 Thomas Koenig PR fortran/45159 * dependency.c (gfc_deb_compare_expr): Remove any integer conversion functions to larger types from both arguments. Remove handling these functions futher down. 2010-08-03 Thomas Koenig PR fortran/45159 * gfortran.dg/dependency_30.f90: New test. Index: dependency.c =================================================================== --- dependency.c (Revision 162829) +++ dependency.c (Arbeitskopie) @@ -180,7 +180,45 @@ gfc_dep_compare_expr (gfc_expr *e1, gfc_expr *e2) gfc_actual_arglist *args1; gfc_actual_arglist *args2; int i; + gfc_expr *n1, *n2; + n1 = NULL; + n2 = NULL; + + /* Remove any integer conversion functions to larger types. */ + if (e1->expr_type == EXPR_FUNCTION && e1->value.function.isym + && e1->value.function.isym->id == GFC_ISYM_CONVERSION + && e1->ts.type == BT_INTEGER) + { + args1 = e1->value.function.actual; + if (args1->expr->ts.type == BT_INTEGER + && e1->ts.kind > args1->expr->ts.kind) + n1 = args1->expr; + } + + if (e2->expr_type == EXPR_FUNCTION && e2->value.function.isym + && e2->value.function.isym->id == GFC_ISYM_CONVERSION + && e2->ts.type == BT_INTEGER) + { + args2 = e2->value.function.actual; + if (args2->expr->ts.type == BT_INTEGER + && e2->ts.kind > args2->expr->ts.kind) + n2 = args2->expr; + } + + if (n1 != NULL) + { + if (n2 != NULL) + return gfc_dep_compare_expr (n1, n2); + else + return gfc_dep_compare_expr (n1, e2); + } + else + { + if (n2 != NULL) + return gfc_dep_compare_expr (e1, n2); + } + if (e1->expr_type == EXPR_OP && (e1->value.op.op == INTRINSIC_UPLUS || e1->value.op.op == INTRINSIC_PARENTHESES)) @@ -328,20 +366,6 @@ gfc_dep_compare_expr (gfc_expr *e1, gfc_expr *e2) argument lists. */ switch (e1->value.function.isym->id) { - case GFC_ISYM_CONVERSION: - /* Handle integer extensions specially, as __convert_i4_i8 - is not only "constant" but also "unary" and "increasing". */ - if (args1 && !args1->next - && args2 && !args2->next - && e1->ts.type == BT_INTEGER - && args1->expr->ts.type == BT_INTEGER - && e1->ts.kind > args1->expr->ts.kind - && e2->ts.type == e1->ts.type - && e2->ts.kind == e1->ts.kind - && args2->expr->ts.type == args1->expr->ts.type - && args2->expr->ts.kind == args2->expr->ts.kind) - return gfc_dep_compare_expr (args1->expr, args2->expr); - break; case GFC_ISYM_REAL: case GFC_ISYM_LOGICAL: