From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 44296 invoked by alias); 21 May 2016 09:36:23 -0000 Mailing-List: contact jit-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Post: List-Help: List-Subscribe: Sender: jit-owner@gcc.gnu.org Received: (qmail 44270 invoked by uid 89); 21 May 2016 09:36:22 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Checked: by ClamAV 0.99.1 on sourceware.org X-Virus-Found: No X-Spam-SWARE-Status: No, score=1.2 required=5.0 tests=AWL,BAYES_50,KAM_LAZY_DOMAIN_SECURITY,RCVD_IN_DNSWL_LOW autolearn=no version=3.3.2 spammy=8276, 1756, 58ca, 942b X-Spam-Status: No, score=1.2 required=5.0 tests=AWL,BAYES_50,KAM_LAZY_DOMAIN_SECURITY,RCVD_IN_DNSWL_LOW autolearn=no version=3.3.2 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on sourceware.org X-Spam-Level: * X-Spam-User: qpsmtpd, 2 recipients X-HELO: mail-out.m-online.net X-Virus-Scanned: amavisd-new at mnet-online.de X-Auth-Info: F8VJ9S1WOhhGYnOg0l48iKHRrts9rA4eDe6kU2taABNXBbJjjIPEAsucSMGZu02L From: Andreas Schwab To: David Malcolm Cc: gcc-patches@gcc.gnu.org, jit@gcc.gnu.org Subject: Re: [PATCH 2/3] Implement CALL_EXPR_MUST_TAIL_CALL References: <1463522492-43504-1-git-send-email-dmalcolm@redhat.com> <1463522492-43504-3-git-send-email-dmalcolm@redhat.com> X-Yow: I'm having a RELIGIOUS EXPERIENCE.. and I don't take any DRUGS Date: Fri, 01 Jan 2016 00:00:00 -0000 In-Reply-To: <1463522492-43504-3-git-send-email-dmalcolm@redhat.com> (David Malcolm's message of "Tue, 17 May 2016 18:01:31 -0400") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.94 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-SW-Source: 2016-q2/txt/msg00047.txt.bz2 David Malcolm writes: > diff --git a/gcc/testsuite/gcc.dg/plugin/must-tail-call-2.c b/gcc/testsuite/gcc.dg/plugin/must-tail-call-2.c > new file mode 100644 > index 0000000..c5504f8 > --- /dev/null > +++ b/gcc/testsuite/gcc.dg/plugin/must-tail-call-2.c > @@ -0,0 +1,58 @@ > +/* Allow nested functions. */ > +/* { dg-options "-Wno-pedantic" } */ > + > +struct box { char field[64]; int i; }; > + > +struct box __attribute__((noinline,noclone)) > +returns_struct (int i) > +{ > + struct box b; > + b.i = i * i; > + return b; > +} > + > +int __attribute__((noinline,noclone)) > +test_1 (int i) > +{ > + return returns_struct (i * 5).i; /* { dg-error "cannot tail-call: callee returns a structure" } */ > +} > + > +int __attribute__((noinline,noclone)) > +test_2_callee (int i, struct box b) > +{ > + if (b.field[0]) > + return 5; > + return i * i; > +} > + > +int __attribute__((noinline,noclone)) > +test_2_caller (int i) > +{ > + struct box b; > + return test_2_callee (i + 1, b); /* { dg-error "cannot tail-call: callee required more stack slots than the caller" } */ > +} > + > +extern void setjmp (void); > +void > +test_3 (void) > +{ > + setjmp (); /* { dg-error "cannot tail-call: callee returns twice" } */ > +} > + > +void > +test_4 (void) > +{ > + void nested (void) > + { > + } > + nested (); /* { dg-error "cannot tail-call: nested function" } */ > +} > + > +typedef void (fn_ptr_t) (void); > +volatile fn_ptr_t fn_ptr; > + > +void > +test_5 (void) > +{ > + fn_ptr (); /* { dg-error "cannot tail-call: callee does not return" } */ > +} On ia64: FAIL: gcc.dg/plugin/must-tail-call-2.c -fplugin=./must_tail_call_plugin.so (test for errors, line 39) FAIL: gcc.dg/plugin/must-tail-call-2.c -fplugin=./must_tail_call_plugin.so (test for errors, line 57) FAIL: gcc.dg/plugin/must-tail-call-2.c -fplugin=./must_tail_call_plugin.so (test for excess errors) Excess errors: gcc.dg/plugin/must-tail-call-2.c:39:3: error: cannot tail-call: target is not able to optimize the call into a sibling call gcc.dg/plugin/must-tail-call-2.c:57:3: error: cannot tail-call: target is not able to optimize the call into a sibling call On m68k: FAIL: gcc.dg/plugin/must-tail-call-2.c -fplugin=./must_tail_call_plugin.so (test for errors, line 48) FAIL: gcc.dg/plugin/must-tail-call-2.c -fplugin=./must_tail_call_plugin.so (test for excess errors) Excess errors: gcc.dg/plugin/must-tail-call-2.c:48:3: error: cannot tail-call: target is not able to optimize the call into a sibling call Andreas. -- Andreas Schwab, schwab@linux-m68k.org GPG Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5 "And now for something completely different."