public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Thomas Schwinge <tschwinge@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org
Subject: [gcc r14-3873] nvptx: stack size limits are relevant for execution only
Date: Tue, 12 Sep 2023 09:43:26 +0000 (GMT)	[thread overview]
Message-ID: <20230912094326.3DCB53858431@sourceware.org> (raw)

https://gcc.gnu.org/g:56004123ab74193d88ad297877fa4e2a0d7ef5b1

commit r14-3873-g56004123ab74193d88ad297877fa4e2a0d7ef5b1
Author: Thomas Schwinge <thomas@codesourcery.com>
Date:   Tue Nov 8 12:10:03 2022 +0100

    nvptx: stack size limits are relevant for execution only
    
    For non-'dg-do run' test cases, that means: big 'dg-require-stack-size' need
    not be UNSUPPORTED (and indeed now do all PASS), 'dg-add-options stack_size'
    need not define (and thus limit) 'STACK_SIZE' (and still do all PASS).
    
    Re "Find 'dg-do-what' in an outer frame", currently (sources not completely
    clean, though), we've got:
    
        $ git grep -F 'check_effective_target_stack_size: found dg-do-what at level ' -- build-gcc/\*.log | sort | uniq -c
              6 build-gcc/gcc/testsuite/gcc/gcc.log:check_effective_target_stack_size: found dg-do-what at level 2
            267 build-gcc/gcc/testsuite/gcc/gcc.log:check_effective_target_stack_size: found dg-do-what at level 3
            239 build-gcc/gcc/testsuite/gcc/gcc.log:check_effective_target_stack_size: found dg-do-what at level 4
    
            gcc/testsuite/
            * lib/target-supports.exp (check_effective_target_stack_size): For
            nvptx target, stack size limits are relevant for execution only.
            gcc/
            * doc/sourcebuild.texi (stack_size): Update.

Diff:
---
 gcc/doc/sourcebuild.texi              |  4 ++++
 gcc/testsuite/lib/target-supports.exp | 16 ++++++++++++++++
 2 files changed, 20 insertions(+)

diff --git a/gcc/doc/sourcebuild.texi b/gcc/doc/sourcebuild.texi
index de1aa8c2dbab..8bf701461ec6 100644
--- a/gcc/doc/sourcebuild.texi
+++ b/gcc/doc/sourcebuild.texi
@@ -2932,6 +2932,10 @@ Target has limited stack size.  The stack size limit can be obtained using the
 STACK_SIZE macro defined by @ref{stack_size_ao,,@code{dg-add-options} feature
 @code{stack_size}}.
 
+Note that for certain targets, stack size limits are relevant for
+execution only, and therefore considered only if @code{dg-do run} is
+in effect, otherwise unlimited.
+
 @item static
 Target supports @option{-static}.
 
diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp
index 0ea8bcb24e1b..1080a5cfc443 100644
--- a/gcc/testsuite/lib/target-supports.exp
+++ b/gcc/testsuite/lib/target-supports.exp
@@ -649,6 +649,22 @@ proc check_effective_target_trampolines { } {
 # Return 1 if target has limited stack size.
 
 proc check_effective_target_stack_size { } {
+    # For nvptx target, stack size limits are relevant for execution only.
+    if { [istarget nvptx-*-*] } {
+	# Find 'dg-do-what' in an outer frame.
+	set level 1
+	while true {
+	    upvar $level dg-do-what dg-do-what
+	    if [info exists dg-do-what] then break
+	    incr level
+	}
+	verbose "check_effective_target_stack_size: found dg-do-what at level $level" 2
+
+	if { ![string equal [lindex ${dg-do-what} 0] run] } {
+	    return 0
+	}
+    }
+
     if [target_info exists gcc,stack_size] {
 	return 1
     }

                 reply	other threads:[~2023-09-12  9:43 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20230912094326.3DCB53858431@sourceware.org \
    --to=tschwinge@gcc.gnu.org \
    --cc=gcc-cvs@gcc.gnu.org \
    /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).