public inbox for jit@gcc.gnu.org
 help / color / mirror / Atom feed
From: David Malcolm <dmalcolm@redhat.com>
To: Thomas Preudhomme <thomas.preudhomme@foss.arm.com>,
	gcc-patches@gcc.gnu.org
Cc: Rainer Orth <ro@cebitec.uni-bielefeld.de>,
	jit@gcc.gnu.org, Andreas Schwab <schwab@linux-m68k.org>
Subject: Re: [PATCH] Fixes to must-tail-call tests
Date: Fri, 01 Jan 2016 00:00:00 -0000	[thread overview]
Message-ID: <1464371096.11895.4.camel@redhat.com> (raw)
In-Reply-To: <1601047.CBIjQzlDQq@e108577-lin>

[-- Attachment #1: Type: text/plain, Size: 2757 bytes --]

On Fri, 2016-05-27 at 13:29 +0100, Thomas Preudhomme wrote:
> Hi Rainer,
> 
> On Wednesday 25 May 2016 11:31:12 Rainer Orth wrote:
> > David Malcolm <dmalcolm@redhat.com> writes:
> > > The following fixes the known failures of the must-tail-call
> > > tests.
> > > 
> > > Tested with --target=
> > > * aarch64-unknown-linux-gnu
> > > * ia64-unknown-linux-gnu
> > > * m68k-unknown-linux-gnu
> > > * x86_64-pc-linux-gnu
> > 
> > Even with this patch, there are still failures on sparc-sun
> > -solaris2.12:
> > 
> > FAIL: gcc.dg/plugin/must-tail-call-1.c 
> > -fplugin=./must_tail_call_plugin.so
> > (test for excess errors)
> > 
> > Excess errors:
> > /vol/gcc/src/hg/trunk/local/gcc/testsuite/gcc.dg/plugin/must-tail
> > -call-1.c:1
> > 2:10: error: cannot tail-call: target is not able to optimize the
> > call into
> > a sibling call
> > 
> > FAIL: gcc.dg/plugin/must-tail-call-2.c 
> > -fplugin=./must_tail_call_plugin.so
> > (test for excess errors)
> > 
> > Excess errors:
> > /vol/gcc/src/hg/trunk/local/gcc/testsuite/gcc.dg/plugin/must-tail
> > -call-2.c:3
> > 2:10: error: cannot tail-call: target is not able to optimize the
> > call into
> > a sibling call


My aim with these tests was to try to cover the various ways in which
mandatory tail-call optimization can fail.

However, this is very target-dependent, and, as written, the test over
-specifies the output.

Sorry about this.

I've run the test on all of the configurations in contrib/config
-list.mk (using the patch kit in
  https://gcc.gnu.org/ml/gcc-patches/2016-05/msg02100.html )

Collated output can be seen here:
  https://dmalcolm.fedorapeople.org/gcc/2016-05-27/must-tail-call-logs.txt
showing all the different error messages across every configuration.

It's not clear to me what the best way forward here is.
We could simply check for
   error: cannot tail-call:
and leave the precise messages we're checking for unspecified.

If we care about checking for the precise messages, one of more
duplicate copy(s) of the test could be provided, filtering by target to
specify precise targets, giving more precise output, where this is
known.

I'm attaching a patch (sans ChangeLog) which strips the precise
messages in the manner described above.  Retesting on all targets with
this patch, the only remaining failures are of the form:
  must-tail-call-1.c:12:10: error: cannot tail-call: machine
description does not have a sibcall_epilogue instruction pattern
on targets lacking the pattern.

Thoughts?

Sorry again about the breakage

Dave


> Now that the logic is in place, you probably want to add sparc-sun
> -solaris in 
> plugin.exp to the the list of architecture where tail call plugin
> tests should 
> be skipped, alongside Thumb-1 ARM targets.
> 
> Best regards,
> 

[-- Attachment #2: generic-error-message.patch --]
[-- Type: text/x-patch, Size: 1489 bytes --]

diff --git a/gcc/testsuite/gcc.dg/plugin/must-tail-call-2.c b/gcc/testsuite/gcc.dg/plugin/must-tail-call-2.c
index c5504f8..c6dfecd 100644
--- a/gcc/testsuite/gcc.dg/plugin/must-tail-call-2.c
+++ b/gcc/testsuite/gcc.dg/plugin/must-tail-call-2.c
@@ -14,7 +14,7 @@ returns_struct (int i)
 int __attribute__((noinline,noclone))
 test_1 (int i)
 {
-  return returns_struct (i * 5).i; /* { dg-error "cannot tail-call: callee returns a structure" } */
+  return returns_struct (i * 5).i; /* { dg-error "cannot tail-call: " } */
 }
 
 int __attribute__((noinline,noclone))
@@ -29,14 +29,14 @@ 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" } */
+  return test_2_callee (i + 1, b); /* { dg-error "cannot tail-call: " } */
 }
 
 extern void setjmp (void);
 void
 test_3 (void)
 {
-  setjmp (); /* { dg-error "cannot tail-call: callee returns twice" } */
+  setjmp (); /* { dg-error "cannot tail-call: " } */
 }
 
 void
@@ -45,7 +45,7 @@ test_4 (void)
   void nested (void)
   {
   }
-  nested (); /* { dg-error "cannot tail-call: nested function" } */
+  nested (); /* { dg-error "cannot tail-call: " } */
 }
 
 typedef void (fn_ptr_t) (void);
@@ -54,5 +54,5 @@ volatile fn_ptr_t fn_ptr;
 void
 test_5 (void)
 {
-  fn_ptr (); /* { dg-error "cannot tail-call: callee does not return" } */
+  fn_ptr (); /* { dg-error "cannot tail-call: " } */
 }

  reply	other threads:[~2016-05-27 17:45 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-01  0:00 [PATCH 0/3] Support for mandatory tail calls David Malcolm
2016-01-01  0:00 ` Jeff Law
2016-01-01  0:00   ` Basile Starynkevitch
2016-01-01  0:00     ` Jason Merrill
2016-01-01  0:00       ` Richard Biener
2016-01-01  0:00         ` Jason Merrill
2016-01-01  0:00 ` [PATCH 2/3] Implement CALL_EXPR_MUST_TAIL_CALL David Malcolm
2016-01-01  0:00   ` Jeff Law
2016-01-01  0:00   ` Andreas Schwab
2016-01-01  0:00     ` [PATCH] Fixes to must-tail-call tests David Malcolm
2016-01-01  0:00       ` Rainer Orth
2016-01-01  0:00         ` Thomas Preudhomme
2016-01-01  0:00           ` David Malcolm [this message]
2016-01-01  0:00             ` Jeff Law
2016-01-01  0:00   ` [PATCH 2/3] Implement CALL_EXPR_MUST_TAIL_CALL Andreas Schwab
2016-01-01  0:00 ` [PATCH 3/3] jit: implement gcc_jit_rvalue_set_bool_require_tail_call David Malcolm
2016-01-01  0:00   ` Trevor Saunders
2016-01-01  0:00     ` David Malcolm
2016-01-01  0:00 ` [PATCH 1/3] Introduce can_implement_as_sibling_call_p David Malcolm
2016-01-01  0:00   ` Jeff Law
2016-01-01  0:00   ` Kyrill Tkachov
2016-01-01  0:00     ` [PATCH] calls.c: fix warning on targets without REG_PARM_STACK_SPACE David Malcolm

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1464371096.11895.4.camel@redhat.com \
    --to=dmalcolm@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jit@gcc.gnu.org \
    --cc=ro@cebitec.uni-bielefeld.de \
    --cc=schwab@linux-m68k.org \
    --cc=thomas.preudhomme@foss.arm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).