diff options
author | Thomas Schwinge <tschwinge@baylibre.com> | 2025-02-21 21:54:59 +0100 |
---|---|---|
committer | Thomas Schwinge <tschwinge@baylibre.com> | 2025-02-22 22:37:50 +0100 |
commit | e8e228acffe382f003a7f2ca37c068a5e0c74df4 (patch) | |
tree | 379772f020bc2686d66b487371d61482fecb7be9 /gcc | |
parent | f553b1aaa2b1b925c918e5dcf966290b045321c2 (diff) | |
download | gcc-e8e228acffe382f003a7f2ca37c068a5e0c74df4.zip gcc-e8e228acffe382f003a7f2ca37c068a5e0c74df4.tar.gz gcc-e8e228acffe382f003a7f2ca37c068a5e0c74df4.tar.bz2 |
Gracefully handle the case that 'gcc/testsuite/lib/gcc-dg.exp:find-dg-do-what' has not been called (indirectly) from 'dg-test'
No change in behavior intended.
gcc/testsuite/
* lib/gcc-dg.exp (find-dg-do-what): Gracefully handle the case
that we've not be called (indirectly) from 'dg-test'.
* lib/target-supports.exp (check_effective_target_stack_size)
(check_effective_target_alloca): Catch this.
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/testsuite/lib/gcc-dg.exp | 6 | ||||
-rw-r--r-- | gcc/testsuite/lib/target-supports.exp | 6 |
2 files changed, 11 insertions, 1 deletions
diff --git a/gcc/testsuite/lib/gcc-dg.exp b/gcc/testsuite/lib/gcc-dg.exp index 6e9a7b2..c0adef6 100644 --- a/gcc/testsuite/lib/gcc-dg.exp +++ b/gcc/testsuite/lib/gcc-dg.exp @@ -1375,8 +1375,9 @@ set dg_runtest_extra_prunes "" # the caller of 'find-dg-do-what' may maintain a local 'dg-do-what' variable # without interfering with this search. proc find-dg-do-what { } { + set level [info level] set lookup_level 2 - while true { + while { $lookup_level <= $level } { upvar $lookup_level dg-do-what dg-do-what if { [info exists dg-do-what] } { verbose "find-dg-do-what: found 'dg-do-what' at level $lookup_level: ${dg-do-what}" 2 @@ -1384,4 +1385,7 @@ proc find-dg-do-what { } { } incr lookup_level } + # We've not be called (indirectly) from 'dg-test'. + verbose "find-dg-do-what: have not found 'dg-do-what'" 2 + return [list] } diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp index 7b3172d..4970536 100644 --- a/gcc/testsuite/lib/target-supports.exp +++ b/gcc/testsuite/lib/target-supports.exp @@ -653,6 +653,9 @@ proc check_effective_target_stack_size { } { # For nvptx target, stack size limits are relevant for execution only. if { [istarget nvptx-*-*] } { set dg-do-what [find-dg-do-what] + if { ![llength ${dg-do-what}] } { + error "unexpected call stack" + } if { ![string equal [lindex ${dg-do-what} 0] run] } { return 0 } @@ -1014,6 +1017,9 @@ proc check_effective_target_alloca {} { } set dg-do-what [find-dg-do-what] + if { ![llength ${dg-do-what}] } { + error "unexpected call stack" + } if { [string equal [lindex ${dg-do-what} 0] run] } { # For 'dg-do run', it additionally depends on runtime support. # (If not supported, we don't try to demote 'run' to 'link', |