From patchwork Sat Dec 11 20:14:50 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jerry DeLisle X-Patchwork-Id: 75208 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 3A60FB7082 for ; Sun, 12 Dec 2010 07:14:54 +1100 (EST) Received: (qmail 19671 invoked by alias); 11 Dec 2010 20:14:50 -0000 Received: (qmail 19655 invoked by uid 22791); 11 Dec 2010 20:14:49 -0000 X-SWARE-Spam-Status: No, hits=-2.1 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_LOW, SPF_NEUTRAL, TW_SV X-Spam-Check-By: sourceware.org Received: from out02.roch.ny.frontiernet.net (HELO out02.roch.ny.frontiernet.net) (66.133.183.227) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sat, 11 Dec 2010 20:14:44 +0000 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AvsEAFZqA01Hc8gt/2dsb2JhbACkDsA2hUoEhGQ Received: from relay03.roch.ny.frontiernet.net ([66.133.182.166]) by out02.roch.ny.frontiernet.net with ESMTP; 11 Dec 2010 20:14:42 +0000 X-Previous-IP: 71.115.200.45 Received: from quava.localdomain (pool-71-115-200-45.spknwa.dsl-w.verizon.net [71.115.200.45]) by relay03.roch.ny.frontiernet.net (Postfix) with ESMTPA id 1366B10256; Sat, 11 Dec 2010 20:14:40 +0000 (UTC) Message-ID: <4D03DBBA.3050001@frontier.com> Date: Sat, 11 Dec 2010 12:14:50 -0800 From: Jerry DeLisle User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.12) Gecko/20101103 Fedora/1.0-0.33.b2pre.fc14 Thunderbird/3.1.6 MIME-Version: 1.0 To: gfortran CC: gcc patches Subject: [patch, fortran] [4.6 Regression] wrong results with MATMUL(..., TRANSPOSE (func ())) -- 465.tonto test run 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 Fixed after review and approval by Tobias on IRC. $ svn commit ChangeLog trans-array.c Sending ChangeLog Sending trans-array.c Transmitting file data .. Committed revision 167713. Best regards, Jerry 2010-12-11 Mikael Morin Jerry DeLisle PR fortran/46842 * trans-array.c (dim_ok): New helper function. (gfc_conv_expr_descriptor): Use new helper function to check function array is full. Index: trans-array.c =================================================================== --- trans-array.c (revision 167711) +++ trans-array.c (working copy) @@ -5293,6 +5293,16 @@ } } +/* Helper function to check dimensions. */ +static bool +dim_ok (gfc_ss_info *info) +{ + int n; + for (n = 0; n < info->dimen; n++) + if (info->dim[n] != n) + return false; + return true; +} /* Convert an array for passing as an actual argument. Expressions and vector subscripts are evaluated and stored in a temporary, which is then @@ -5378,15 +5388,7 @@ else full = gfc_full_array_ref_p (info->ref, NULL); - if (full) - for (n = 0; n < info->dimen; n++) - if (info->dim[n] != n) - { - full = 0; - break; - } - - if (full) + if (full && dim_ok (info)) { if (se->direct_byref && !se->byref_noassign) { @@ -5588,7 +5590,7 @@ desc = loop.temp_ss->data.info.descriptor; } - else if (expr->expr_type == EXPR_FUNCTION) + else if (expr->expr_type == EXPR_FUNCTION && dim_ok (info)) { desc = info->descriptor; se->string_length = ss->string_length;