From patchwork Mon Apr 15 21:20:12 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Law X-Patchwork-Id: 1085918 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-499277-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="EH4zZmX4"; 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 44jhHM48yTz9s5c for ; Tue, 16 Apr 2019 07:20:24 +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:from :to:subject:message-id:date:mime-version:content-type; q=dns; s= default; b=T7YrEvDbWvMW5x8GhxDL++kTGGD3TiQsYJnBQVMP5SWDvDWJlyy8j 9XVl44HD9uswZvkdsGqg+RvRC+y7rQ6CZv5wYkWDNMoLUS2UGd3mpyj8+gmc8RZ2 1IdWcxjuEB/etUKtqdUGgfM3B7cvrV6oV9hM4RPKxqULQUdpF+Vuds= 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:from :to:subject:message-id:date:mime-version:content-type; s= default; bh=LXPPPzgHDZv1zdpN8Ucz+8wb8+Q=; b=EH4zZmX4cYlTFHXZHlJx +DUjOmV29XFn7xcw630PQ2/od+LRT7+qBDDsH7CaaUM321iBK+FqrFChg0fstJyW yXURLIrbiFnL1Xp3VmWeN3MbgHaN0ytVuDOLayZW4FvdngCe9vyjYqhUBAYQXvVX 6+qIuR2QzQY1OLmASzP9/zU= Received: (qmail 105108 invoked by alias); 15 Apr 2019 21:20:17 -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 105100 invoked by uid 89); 15 Apr 2019 21:20:16 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-14.3 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, SPF_HELO_PASS autolearn=ham version=3.3.1 spammy=audit, CONST_INT, thankfully X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 15 Apr 2019 21:20:15 +0000 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 853B13082137 for ; Mon, 15 Apr 2019 21:20:14 +0000 (UTC) Received: from localhost.localdomain (ovpn-112-8.rdu2.redhat.com [10.10.112.8]) by smtp.corp.redhat.com (Postfix) with ESMTP id AE9BA60C05 for ; Mon, 15 Apr 2019 21:20:13 +0000 (UTC) From: Jeff Law Openpgp: preference=signencrypt To: gcc-patches Subject: [committed] Fix various microblaze-linux failures Message-ID: <2e40b940-62c1-2152-9256-6754a96e3172@redhat.com> Date: Mon, 15 Apr 2019 15:20:12 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.4.0 MIME-Version: 1.0 X-IsSubscribed: yes microblaze testing in my tester has occasionally been failing Warray-bounds-40 and Wstringop-overflow-9. I finally took a little peek because these occasional failures show up as a regression against the prior run. It looks like the microblaze backend is trying to inline a move of SIZE_MAX bytes. Ugh. Not surprisingly the problem is the target bits treating the size as a signed integer in a comparison. Fixing this is pretty simple thankfully. I didn't audit the entire port, just microblaze_expand_block_move. Here's what I'm installing on the trunk -- it basically ensures we treat the size and alignment as unsigned values. It also fixes errors with string-large-1.c. Jeff * config/microblaze/microblaze.c (microblaze_expand_block_move): Treat size and alignment as unsigned. diff --git a/gcc/config/microblaze/microblaze.c b/gcc/config/microblaze/microblaze.c index 70910fd1dde..55c1becf975 100644 --- a/gcc/config/microblaze/microblaze.c +++ b/gcc/config/microblaze/microblaze.c @@ -1258,8 +1258,8 @@ microblaze_expand_block_move (rtx dest, rtx src, rtx length, rtx align_rtx) if (GET_CODE (length) == CONST_INT) { - HOST_WIDE_INT bytes = INTVAL (length); - int align = INTVAL (align_rtx); + unsigned HOST_WIDE_INT bytes = UINTVAL (length); + unsigned int align = UINTVAL (align_rtx); if (align > UNITS_PER_WORD) { @@ -1267,7 +1267,7 @@ microblaze_expand_block_move (rtx dest, rtx src, rtx length, rtx align_rtx) } else if (align < UNITS_PER_WORD) { - if (INTVAL (length) <= MAX_MOVE_BYTES) + if (UINTVAL (length) <= MAX_MOVE_BYTES) { move_by_pieces (dest, src, bytes, align, RETURN_BEGIN); return true; @@ -1276,14 +1276,14 @@ microblaze_expand_block_move (rtx dest, rtx src, rtx length, rtx align_rtx) return false; } - if (INTVAL (length) <= 2 * MAX_MOVE_BYTES) + if (UINTVAL (length) <= 2 * MAX_MOVE_BYTES) { - microblaze_block_move_straight (dest, src, INTVAL (length)); + microblaze_block_move_straight (dest, src, UINTVAL (length)); return true; } else if (optimize) { - microblaze_block_move_loop (dest, src, INTVAL (length)); + microblaze_block_move_loop (dest, src, UINTVAL (length)); return true; } }