From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ej1-x62d.google.com (mail-ej1-x62d.google.com [IPv6:2a00:1450:4864:20::62d]) by sourceware.org (Postfix) with ESMTPS id 8D99F3858024 for ; Sun, 14 Feb 2021 11:38:39 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 8D99F3858024 Received: by mail-ej1-x62d.google.com with SMTP id f14so6698671ejc.8 for ; Sun, 14 Feb 2021 03:38:39 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=co4YBeYxjaXkEoyw3h3IXgEmVK3dmJp7u5XkUQwIB/w=; b=ClHIV93XSrW5uWNS1pnXfHGpHBNCxh0E4p2cpTlYCrPvyXdtgQ5VU3cMyM/CUpFczM U8Nb1oiFbYjCZd9cHhAm+CEKZ2CBtrz/lfFrEY5bejL5wbgJv/2/LzKy0oGz2KuAkxgf s218tQ0WnnmRgyoSf2RVinSmZ1s9ynrJAXRAPE7K4GqBNtghM42WG5oS3sEpr7pp9K+6 QKGmj7ycpW3/64nSbQJIaCe7TeUvEEUcs4GKh9Vr5ssBB10LQU1HjVI/yrhlEZDTZtsn akeN2NeLfr1ZtZUd5y+AZSEROnDC9nLVIfx6BEOJlpcKVrPnBsURE73vAp1Ygbpj1xv+ mS1g== X-Gm-Message-State: AOAM533MmGVh/bQmKYWNmPNS6Yx2jqz/ex+kjce/zmrFoB98/y/W/PCu uWhQzBzBjYspW1j+erKlwUd1EobUTbVvnhRqveCL0a0srXHGkg== X-Google-Smtp-Source: ABdhPJw/lci0KIHCGlPAmw/tVexWonFA0Dfli+v4p0R8tN4CAxSJm8PguRJiFJ70CMDTJit1tpJ9JkDW2DX+p3jfST0= X-Received: by 2002:a17:906:7d9:: with SMTP id m25mr11023645ejc.473.1613302717368; Sun, 14 Feb 2021 03:38:37 -0800 (PST) MIME-Version: 1.0 From: Stefan Ring Date: Sun, 14 Feb 2021 12:38:26 +0100 Message-ID: Subject: Interesting regression in parameter passing (x86_64) To: gcc-help Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-2.3 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gcc-help@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-help mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 14 Feb 2021 11:38:41 -0000 I recently noticed that gcc 9 introduced a strange push/pop pair in a function that does nothing other than shift all arguments by one position and transfer control to another function: int func(int, int, int, int, int, int); int caller(int a, int b, int c, int d, int e) { return func(0, a, b, c, d, e); } pushq %r12 movl %r8d, %r9d popq %r12 movl %ecx, %r8d movl %edx, %ecx movl %esi, %edx movl %edi, %esi xorl %edi, %edi jmp func Obviously, pushing and popping r12 serves no useful purpose, and gcc 8 does not produce it. It also disappears when a is used instead of the constant 0 as the first argument. Where does this come from?