From patchwork Sat Oct 6 11:47:42 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Koenig X-Patchwork-Id: 979934 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-487064-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=quarantine dis=none) header.from=netcologne.de Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="luM0omj3"; dkim=pass (2048-bit key; unprotected) header.d=netcologne.de header.i=@netcologne.de header.b="blVH02QZ"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 42S4ct6tgJz9s1x for ; Sat, 6 Oct 2018 21:47:55 +1000 (AEST) 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=Waw1jtxK7b0q0pzcmB3wFAHxG1L6pheEcSwfLZgEfEAKhJ/YIn BaGVeKI6yd+IlRacl/i0HduYMzA/b43M02UBg9TViK4wIDtVjQqHyTK/tHgKH9Kz KzDz38Z7xgGkU2bA+Z5ZSwjAc5NSMyOYIsJISKOvdYgPdCxC5uuWGUTtY= 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=0TTIvbQZ11HvqfZrBqkPSxnRUEA=; b=luM0omj3w0qKmhlyJ+By hZqHFtkDGHMSGjLNHjGbRUSM4DgzHKs0j16Laao/jERVMl9GksAzEV2uPCaMr7bu h6l0r2DedyaQoWnm4haWaO4Y0eFeJpycD4xO8rZwi60UGqg/rSac780sED2TpB6u 6dJyx7HoD59mKUWyV+ujY0M= Received: (qmail 55156 invoked by alias); 6 Oct 2018 11:47:48 -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 55137 invoked by uid 89); 6 Oct 2018 11:47:47 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-11.3 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_2, GIT_PATCH_3, KAM_NUMSUBJECT, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 spammy=Hx-languages-length:1800, Arbeitskopie, arbeitskopie 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, 06 Oct 2018 11:47:45 +0000 Received: from cc-smtpin1.netcologne.de (cc-smtpin1.netcologne.de [89.1.8.201]) by cc-smtpout2.netcologne.de (Postfix) with ESMTP id 73BAB12510; Sat, 6 Oct 2018 13:47:43 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=netcologne.de; s=nc1116a; t=1538826463; bh=81cBXDc91T9kiJHjHSZtxdILH39J/4j1j9g5EnERY5w=; h=To:From:Subject:Message-ID:Date:From; b=blVH02QZ5+Wjd7cDyAHwWqe/7w1rx8elkRg/z2NnYDD/gQVzB73Ze5YxvrnSLVkM4 EMqZmulYEewzGTkcS9bTdbMUElbyRyvF8zaUtRMYnl8w50retiqS2lVaPZ3fF9RyS/ +DYNUWrqu7aN8Q7cf68tCNqpxlWFWmQKM2ZcV69IeLJKVh8aKeiMcAp+HlqiAJ+ZNg cQPaQxb/bKgHdVDSdHvebdLGgHJq7EaZ0VXnp9rUAl0CrRJOXWfyF2YvSmI0/0Uy8z wut/7msZWaTymRVXYNAlfB8FRfCIfoNgn1hxYBZ1fGX2iB2VPXfL9lm0knnPKuQKmy 1SW5KyzCSYjDw== Received: from localhost (localhost [127.0.0.1]) by cc-smtpin1.netcologne.de (Postfix) with ESMTP id 704FB11D92; Sat, 6 Oct 2018 13:47:43 +0200 (CEST) Received: from [78.35.136.172] (helo=cc-smtpin1.netcologne.de) by localhost with ESMTP (eXpurgate 4.6.0) (envelope-from ) id 5bb8a0df-5f8a-7f0000012729-7f000001a752-1 for ; Sat, 06 Oct 2018 13:47:43 +0200 Received: from [192.168.178.68] (xdsl-78-35-136-172.netcologne.de [78.35.136.172]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by cc-smtpin1.netcologne.de (Postfix) with ESMTPSA; Sat, 6 Oct 2018 13:47:42 +0200 (CEST) To: "fortran@gcc.gnu.org" , gcc-patches From: Thomas Koenig Subject: [patch, committed] Fix PR 84640 Message-ID: <35b62772-6063-5df5-5e5c-6ecce948312b@netcologne.de> Date: Sat, 6 Oct 2018 13:47:42 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.0 MIME-Version: 1.0 Hi, I just committed the fix below as obvious and simple. No test case because the problem was only visible in with an instrumented compiler. Regards Thomas 2018-10-06 Thomas Koenig PR fortran/84640 * simplify.c (gfc_simplify_cshift): Extend size of hs_ex and ss_ex by one. Set extents one past the array boundaries to zero to avoid warning with instrumented compiler. (gfc_simplify_eoshift): Likewise, only for ss_ex. Index: simplify.c =================================================================== --- simplify.c (Revision 264897) +++ simplify.c (Arbeitskopie) @@ -2011,11 +2011,11 @@ gfc_simplify_cshift (gfc_expr *array, gfc_expr *sh ssize_t *shiftvec, *hptr; ssize_t shift_val, len; ssize_t count[GFC_MAX_DIMENSIONS], extent[GFC_MAX_DIMENSIONS], - hs_ex[GFC_MAX_DIMENSIONS], + hs_ex[GFC_MAX_DIMENSIONS + 1], hstride[GFC_MAX_DIMENSIONS], sstride[GFC_MAX_DIMENSIONS], a_extent[GFC_MAX_DIMENSIONS], a_stride[GFC_MAX_DIMENSIONS], h_extent[GFC_MAX_DIMENSIONS], - ss_ex[GFC_MAX_DIMENSIONS]; + ss_ex[GFC_MAX_DIMENSIONS + 1]; ssize_t rsoffset; int d, n; bool continue_loop; @@ -2110,6 +2110,8 @@ gfc_simplify_cshift (gfc_expr *array, gfc_expr *sh n++; } } + ss_ex[n] = 0; + hs_ex[n] = 0; if (shiftvec) { @@ -2403,7 +2405,7 @@ gfc_simplify_eoshift (gfc_expr *array, gfc_expr *s ssize_t shift_val, len; ssize_t count[GFC_MAX_DIMENSIONS], extent[GFC_MAX_DIMENSIONS], sstride[GFC_MAX_DIMENSIONS], a_extent[GFC_MAX_DIMENSIONS], - a_stride[GFC_MAX_DIMENSIONS], ss_ex[GFC_MAX_DIMENSIONS]; + a_stride[GFC_MAX_DIMENSIONS], ss_ex[GFC_MAX_DIMENSIONS + 1]; ssize_t rsoffset; int d, n; bool continue_loop; @@ -2546,6 +2548,7 @@ gfc_simplify_eoshift (gfc_expr *array, gfc_expr *s n++; } } + ss_ex[n] = 0; continue_loop = true; d = array->rank;