From patchwork Mon May 1 22:23:16 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nathan Sidwell X-Patchwork-Id: 757343 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]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3wGzTZ6dn7z9sNH for ; Tue, 2 May 2017 08:23:29 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="Dy8dYF8B"; dkim-atps=neutral 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=QLF0f54Hx+rSmR5pkdajo9SpvhOLkhGuGXSH1DWXrITAzN1l/D I7Y4Ov5ek2A7q0I9pVh2DOLpS2jp2R09BUGiyYT9WINgnzryCocNvUeYTvUW4a6y VNu8BAMDT3+nzl63+Q7BzYR/l/eK4fwIm8jfNK7Mi3J/Gg+D9j09JgCe8= 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=FuGSad/IBH97l/UDPV0XElujiI4=; b=Dy8dYF8BhoO2Ou86vpHN jnGfXQz0slMX20o990YBvoO+DqcMxorjnA66gXlaWY2XnGZ8Tx3XYL2MvmCAEw8+ bzaU7ZL4rJNG65fJTjiWKX7hb8YS5YkBOrzI6jtnCEICAwK323fRbDZs6toLTArF 3Z336hipQYV3VPEPJ8Le+O4= Received: (qmail 28957 invoked by alias); 1 May 2017 22:23:20 -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 28917 invoked by uid 89); 1 May 2017 22:23:18 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-11.4 required=5.0 tests=BAYES_00, FREEMAIL_FROM, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, RCVD_IN_SORBS_SPAM, SPF_PASS autolearn=ham version=3.3.2 spammy=Hx-languages-length:1338 X-HELO: mail-qt0-f170.google.com Received: from mail-qt0-f170.google.com (HELO mail-qt0-f170.google.com) (209.85.216.170) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 01 May 2017 22:23:17 +0000 Received: by mail-qt0-f170.google.com with SMTP id m36so98917280qtb.0 for ; Mon, 01 May 2017 15:23:19 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:to:from:subject:message-id:date :user-agent:mime-version; bh=9PV7wzV+LM3Xz+vQGrDRdHkXKZ/1aDig0EJrSiBVhMI=; b=JzHyLoeftZfq/3/4FKkJMxrYba+Ei4f3K8ITfgfMzJrJtVhS4uZCkqOQ7wkzOSQ4Im ce25Hf5pov8WUPgVZlfirBUS+GHsuhrO4qlctQLNL5jsowEhH/q/W5HNEEZm0xstxmv6 HjOLsKWPoAPoRew2lGMQwnLpAC6LLOhlB7HfyKmaE+dpi6yajHTJg6+EliG9q3hFK7lN uN1Gx3tDsOBJt3xcvbKQpoeq5g34ht67BtJB3KuTqBBHzT7/2/HentqPlmkPsOo4yazH ge3wH/MewkqZccrN9YwxAwhgsAbSNUEShLcj23rvGVKfbcWx0Z/kRtbIviFe75oDq7tO BS1w== X-Gm-Message-State: AN3rC/69s0z/wB0j2MnopNpL/CColHS0adHrxN0WS/u7331wllWrX0iW 8iunhFcWBC8OTA== X-Received: by 10.200.58.70 with SMTP id w64mr23430280qte.174.1493677398138; Mon, 01 May 2017 15:23:18 -0700 (PDT) Received: from ?IPv6:2601:181:c480:b5c0:cf18:9b2d:9502:2775? ([2601:181:c480:b5c0:cf18:9b2d:9502:2775]) by smtp.googlemail.com with ESMTPSA id s28sm12113570qts.35.2017.05.01.15.23.17 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 01 May 2017 15:23:17 -0700 (PDT) To: GCC Patches From: Nathan Sidwell Subject: [PATCH] stack adjustment is unsigned Message-ID: <2c5076c5-ef4a-1b9a-337a-e90e965af93f@acm.org> Date: Mon, 1 May 2017 18:23:16 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 MIME-Version: 1.0 I happened to notice that stack adjustment code was confusingly testing for an unsigned value being > 0. In this case unadjusted_alignment is of type unsigned HOST_WIDE_INT, so the 'else' portion of the has no effect. This patch simplifies the adjustment to be less confusing (IMHO). booted and tested on x86_64-linux-gnu, ok? Index: gcc/calls.c =================================================================== --- gcc/calls.c (revision 247416) +++ gcc/calls.c (working copy) @@ -2644,13 +2644,8 @@ combine_pending_stack_adjustment_and_cal adjustment = pending_stack_adjust; /* Push enough additional bytes that the stack will be aligned after the arguments are pushed. */ - if (preferred_unit_stack_boundary > 1) - { - if (unadjusted_alignment > 0) - adjustment -= preferred_unit_stack_boundary - unadjusted_alignment; - else - adjustment += unadjusted_alignment; - } + if (preferred_unit_stack_boundary > 1 && unadjusted_alignment) + adjustment -= preferred_unit_stack_boundary - unadjusted_alignment; /* Now, sets ARGS_SIZE->CONSTANT so that we pop the right number of bytes after the call. The right number is the entire