]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
nvptx: stack size limits are relevant for execution only
authorThomas Schwinge <thomas@codesourcery.com>
Tue, 8 Nov 2022 11:10:03 +0000 (12:10 +0100)
committerThomas Schwinge <thomas@codesourcery.com>
Tue, 12 Sep 2023 09:43:07 +0000 (11:43 +0200)
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.

gcc/doc/sourcebuild.texi
gcc/testsuite/lib/target-supports.exp

index de1aa8c2dbabd8c53634c98f4658d8ec59b0b5cd..8bf701461ec67c4e5bae0d2e65a52e9e55c47da9 100644 (file)
@@ -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}.
 
index 0ea8bcb24e1be3ed6f7ec37300a977ac9c148a96..1080a5cfc443a8468ac925dba1206ea5357cade0 100644 (file)
@@ -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
     }