From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10627 invoked by alias); 17 Nov 2015 01:00:35 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 10616 invoked by uid 89); 17 Nov 2015 01:00:34 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.4 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-oi0-f48.google.com Received: from mail-oi0-f48.google.com (HELO mail-oi0-f48.google.com) (209.85.218.48) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Tue, 17 Nov 2015 01:00:33 +0000 Received: by oige206 with SMTP id e206so93524139oig.2 for ; Mon, 16 Nov 2015 17:00:31 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=wgRAw7rP8rBpVMpm0yUfbVxUz88PIVeARIDM6Rm3El8=; b=WECF1hZZjTKiUZUXhqKu1Fgy1Ghm35bi6/WQFTpudBh3ULXlVCSY+f1Uw+++5fJY+l YX20YN3kH/dx+SCwIvagEnt+hbnnHp1Pd7pvBAbMnKWQVhOl5++SZlpjGEnY3lS18WNj f4ATYqeqrPrD5vsPa5lIEOwP27uHMLPNsarefMeQr7VKj/yVXfDLUgsP5y3OYhdzj5fR RjPrGOLKMJB0BZPKoTOuqXsakQmaKl7bQHowKMHsWATQlvnxdNbH0SpWY54imm+Mz2WR Jb6GACK9drUBBy4ldBXIhs68WPS5q6XhHyeJupiDvzUc2bpmn/la2+J8BNBvhwHtCVIW YdFA== X-Gm-Message-State: ALoCoQnHS6j7Kopnyx6c73fgGluN+vnSGb9l0/czSxlPafhNSj2aZB/aJCE34A+LFYux+x4d2Hqx MIME-Version: 1.0 X-Received: by 10.202.218.193 with SMTP id r184mr22477892oig.111.1447722031482; Mon, 16 Nov 2015 17:00:31 -0800 (PST) Received: by 10.202.215.215 with HTTP; Mon, 16 Nov 2015 17:00:31 -0800 (PST) In-Reply-To: <564A57BA.7050504@linaro.org> References: <564A57BA.7050504@linaro.org> Date: Tue, 17 Nov 2015 01:00:00 -0000 Message-ID: Subject: Re: Incorrect code due to indirect tail call of varargs function with hard float ABI From: Charles Baylis To: Kugan Cc: "gcc-patches@gcc.gnu.org" , Richard Earnshaw , Ramana Radhakrishnan , Kyrill Tkachov Content-Type: text/plain; charset=UTF-8 X-IsSubscribed: yes X-SW-Source: 2015-11/txt/msg02022.txt.bz2 On 16 November 2015 at 22:24, Kugan wrote: > Please note that we have a sibcall from "broken" to "indirect". > > "direct" is variadic function so it is conforming to AAPCS base standard. > > "broken" is a non-variadic function and will return the value in > floating point register for TARGET_HARD_FLOAT. Thus we should not be > doing sibcall here. > > Attached patch fixes this. Bootstrap and regression testing is ongoing. > Is this OK if no issues with the testing? Hi Kugan, It looks like this patch should work, but I think this is an overly conservative fix, as it prevents all sibcalls for hardfloat targets. It would be better if only variadic sibcalls were prevented on hardfloat. You can check for variadic calls by checking the function_type in the call expression (exp) using stdarg_p(). As an example to show how to test for variadic function calls, this is how to test it in gdb: (gdb) b arm_function_ok_for_sibcall Breakpoint 1 at 0xdae59c: file /home/cbaylis/srcarea/gcc/gcc-git/gcc/config/arm/arm.c, line 6634. (gdb) r ... Breakpoint 1, arm_function_ok_for_sibcall (decl=0x0, exp=0x7ffff6104ce8) at /home/cbaylis/srcarea/gcc/gcc-git/gcc/config/arm/arm.c:6634 6634 if (cfun->machine->sibcall_blocked) (gdb) print debug_tree(exp) unit size align 64 symtab 0 alias set -1 canonical type 0x7ffff62835e8 precision 64 pointer_to_this > side-effects addressable fn ... (gdb) print stdarg_p((tree)0x7ffff60e9348) <--- from function_type ^^^^^ $2 = true