From patchwork Sat Oct 22 12:33:57 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Koenig X-Patchwork-Id: 78796 Delivered-To: patch@linaro.org Received: by 10.140.97.247 with SMTP id m110csp1756515qge; Sat, 22 Oct 2016 05:34:43 -0700 (PDT) X-Received: by 10.99.178.89 with SMTP id t25mr2928777pgo.60.1477139683208; Sat, 22 Oct 2016 05:34:43 -0700 (PDT) Return-Path: Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id 2si5668187pab.190.2016.10.22.05.34.42 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 22 Oct 2016 05:34:43 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-return-439315-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) client-ip=209.132.180.131; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org; spf=pass (google.com: domain of gcc-patches-return-439315-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=gcc-patches-return-439315-patch=linaro.org@gcc.gnu.org DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:to :from:subject:message-id:date:mime-version:content-type; q=dns; s=default; b=lYrVFAJdY8j5lZalXgph26/jRaQfD6RIL9Yyr+LPVk76o3R2vS fwE9TzH8mrmw+lEj/6FD/xCnq8JHvFxkw5pWnmtZoFme7ddKucNqyiyY3nTIg9h5 DQT3L6hbfX/heN+NboYVQEp6WcUXeCoaLlTN00hbWB5ys0sxWiHx9Ada4= 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:to :from:subject:message-id:date:mime-version:content-type; s= default; bh=h2wEIaKBsqOZPWlEuhwqGeIZles=; b=bT7rAmlzLN7u574YOK+e X7PPRxe5mcJ9VT/f1K+M8S++s9IKCG2/ohUBjXDI4JS+Sgc3hptjT/Nn9DQz6wnK Ca4n9RT065qrg/WJ7gq3En/Pgf2GFdS4VvBEjMv1ItymUe0TSwpofPfD/6dzIbd7 he5FFOpPGtuIaRZWBd+yvb4= Received: (qmail 82900 invoked by alias); 22 Oct 2016 12:34:16 -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 82842 invoked by uid 89); 22 Oct 2016 12:34:15 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.0 required=5.0 tests=AWL, BAYES_00, KAM_LAZY_DOMAIN_SECURITY, RCVD_IN_DNSWL_LOW, RP_MATCHES_RCVD autolearn=ham version=3.3.2 spammy=H*r:sk:tkoenig, shortening, invocations, unequal X-Spam-User: qpsmtpd, 2 recipients X-HELO: cc-smtpout2.netcologne.de Received: from cc-smtpout2.netcologne.de (HELO cc-smtpout2.netcologne.de) (89.1.8.212) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sat, 22 Oct 2016 12:34:04 +0000 Received: from cc-smtpin3.netcologne.de (cc-smtpin3.netcologne.de [89.1.8.203]) by cc-smtpout2.netcologne.de (Postfix) with ESMTP id 460561298F; Sat, 22 Oct 2016 14:34:00 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by cc-smtpin3.netcologne.de (Postfix) with ESMTP id 36C3611DDD; Sat, 22 Oct 2016 14:34:00 +0200 (CEST) Received: from [78.35.148.75] (helo=cc-smtpin3.netcologne.de) by localhost with ESMTP (eXpurgate 4.1.9) (envelope-from ) id 580b5cb8-0b77-7f0000012729-7f000001c644-1 for ; Sat, 22 Oct 2016 14:34:00 +0200 Received: from [192.168.178.20] (xdsl-78-35-148-75.netcologne.de [78.35.148.75]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by cc-smtpin3.netcologne.de (Postfix) with ESMTPSA; Sat, 22 Oct 2016 14:33:58 +0200 (CEST) To: "fortran@gcc.gnu.org" , gcc-patches From: Thomas Koenig Subject: [patch, fortran] Fix PR 78021 Message-ID: <394629cb-40f4-fde1-03e5-fcedb6692eb4@netcologne.de> Date: Sat, 22 Oct 2016 14:33:57 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 MIME-Version: 1.0 Hello world, this rather self-explanatory patch fixes a problem where two function invocations with 'c ' and 'c' as arguments were considered equal. Regression-tested. OK for trunk and 6 and 5 branches? Regards Thomas 2016-10-22 Thomas Koenig PR fortran/78021 * gfc_compare_functions: Strings with different lengths in argument lists compare unequal. 2016-10-22 Thomas Koenig PR fortran/78021 * gfortran.dg/string_length-3.f90: New test. Index: dependency.c =================================================================== --- dependency.c (Revision 240928) +++ dependency.c (Arbeitskopie) @@ -226,10 +226,27 @@ gfc_dep_compare_functions (gfc_expr *e1, gfc_expr if ((args1->expr == NULL) ^ (args2->expr == NULL)) return -2; - if (args1->expr != NULL && args2->expr != NULL - && gfc_dep_compare_expr (args1->expr, args2->expr) != 0) - return -2; + if (args1->expr != NULL && args2->expr != NULL) + { + gfc_expr *e1, *e2; + e1 = args1->expr; + e2 = args2->expr; + if (gfc_dep_compare_expr (e1, e2) != 0) + return -2; + + /* Special case: String arguments which compare equal can have + different lengths, which makes them different in calls to + procedures. */ + + if (e1->expr_type == EXPR_CONSTANT + && e1->ts.type == BT_CHARACTER + && e2->expr_type == EXPR_CONSTANT + && e2->ts.type == BT_CHARACTER + && e1->value.character.length != e2->value.character.length) + return -2; + } + args1 = args1->next; args2 = args2->next; }