From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 93189 invoked by alias); 1 Feb 2018 19:41:10 -0000 Mailing-List: contact fortran-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: fortran-owner@gcc.gnu.org Received: (qmail 93163 invoked by uid 89); 1 Feb 2018 19:41:09 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-11.5 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_2,GIT_PATCH_3,KAM_NUMSUBJECT,RCVD_IN_DNSWL_LOW,SPF_PASS,T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 spammy=H*MI:0918, H*M:0918 X-Spam-User: qpsmtpd, 2 recipients X-HELO: cc-smtpout3.netcologne.de Received: from cc-smtpout3.netcologne.de (HELO cc-smtpout3.netcologne.de) (89.1.8.213) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 01 Feb 2018 19:41:07 +0000 Received: from cc-smtpin3.netcologne.de (cc-smtpin3.netcologne.de [89.1.8.203]) by cc-smtpout3.netcologne.de (Postfix) with ESMTP id BD0A51282E; Thu, 1 Feb 2018 20:41:04 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by cc-smtpin3.netcologne.de (Postfix) with ESMTP id AE3CD11D90; Thu, 1 Feb 2018 20:41:04 +0100 (CET) Received: from [78.35.141.138] (helo=cc-smtpin3.netcologne.de) by localhost with ESMTP (eXpurgate 4.1.9) (envelope-from ) id 5a736d50-02b7-7f0000012729-7f000001b34b-1 for ; Thu, 01 Feb 2018 20:41:04 +0100 Received: from [192.168.178.20] (xdsl-78-35-141-138.netcologne.de [78.35.141.138]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by cc-smtpin3.netcologne.de (Postfix) with ESMTPSA; Thu, 1 Feb 2018 20:41:03 +0100 (CET) To: "fortran@gcc.gnu.org" , gcc-patches From: Thomas Koenig Subject: [patch, fortran] Fix PR 68560 Message-ID: <97d52e14-12e3-d02f-0918-7483927150af@netcologne.de> Date: Thu, 01 Feb 2018 19:41:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.5.2 MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="------------0CED1AE64993B1466131F031" X-SW-Source: 2018-02/txt/msg00003.txt.bz2 This is a multi-part message in MIME format. --------------0CED1AE64993B1466131F031 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-length: 681 Hello world, this patch fixes a regression by removing a KIND argument (which is encoded into the function name anyway) from the call to the library function. This extra argument led to an argument mismatch between the front end and the library and between different instances of the same function. Regression-testing as I write this. If it passes (which I expect), OK for trunk? Regards Thomas 2018-02-01 Thomas Koenig PR fortran/68560 * trans-intrinsic.c (gfc_conv_intrinsic_shape): New function. (gfc_conv_intrinsic_function): Call it. 2018-02-01 Thomas Koenig PR fortran/68560 * gfortran.dg/shape_9.f90: New test. --------------0CED1AE64993B1466131F031 Content-Type: text/x-patch; name="p1.diff" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="p1.diff" Content-length: 1037 Index: trans-intrinsic.c =================================================================== --- trans-intrinsic.c (Revision 257131) +++ trans-intrinsic.c (Arbeitskopie) @@ -5593,6 +5593,25 @@ gfc_conv_intrinsic_ibits (gfc_se * se, gfc_expr * } static void +gfc_conv_intrinsic_shape (gfc_se *se, gfc_expr *expr) +{ + gfc_actual_arglist *s, *k; + gfc_expr *e; + + /* Remove the KIND argument, if present. */ + s = expr->value.function.actual; + k = s->next; + if (k) + { + e = k->expr; + gfc_free_expr (e); + k->expr = NULL; + } + + gfc_conv_intrinsic_funcall (se, expr); +} + +static void gfc_conv_intrinsic_shift (gfc_se * se, gfc_expr * expr, bool right_shift, bool arithmetic) { @@ -8718,6 +8737,10 @@ gfc_conv_intrinsic_function (gfc_se * se, gfc_expr gfc_conv_intrinsic_minmaxloc (se, expr, GT_EXPR); break; + case GFC_ISYM_SHAPE: + gfc_conv_intrinsic_shape (se, expr); + break; + default: gfc_conv_intrinsic_funcall (se, expr); break; --------------0CED1AE64993B1466131F031 Content-Type: text/x-fortran; name="shape_9.f90" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="shape_9.f90" Content-length: 500 ! { dg-do run } ! { dg-require-effective-target lto } ! { dg-options "-flto" } ! Check that there are no warnings with LTO for a KIND argument. ! program test implicit none real, allocatable :: x(:,:) allocate(x(2,5)) if (any(shape(x) /= [ 2, 5 ])) call abort if (any(shape(x,kind=1) /= [ 2, 5 ])) call abort if (any(shape(x,kind=2) /= [ 2, 5 ])) call abort if (any(shape(x,kind=4) /= [ 2, 5 ])) call abort if (any(shape(x,kind=8) /= [ 2, 5 ])) call abort end program test --------------0CED1AE64993B1466131F031--