https://gcc.gnu.org/g:145de77274fb23a70d0cf400eb0b3ff4e41c5fd9
commit 145de77274fb23a70d0cf400eb0b3ff4e41c5fd9 Author: Thomas Schwinge <tschwi...@baylibre.com> Date: Fri Feb 21 11:21:08 2025 +0100 BPF, nvptx: Standardize on 'sorry, unimplemented: dynamic stack allocation not supported' ... instead of BPF: 'error: BPF does not support dynamic stack allocation', and nvptx: 'sorry, unimplemented: target cannot support alloca'. gcc/ * config/bpf/bpf.md (define_expand "allocate_stack"): Emit 'sorry, unimplemented: dynamic stack allocation not supported'. * config/nvptx/nvptx.md (define_expand "allocate_stack") [!TARGET_SOFT_STACK && !(TARGET_PTX_7_3 && TARGET_SM52)]: Likewise. gcc/testsuite/ * gcc.target/bpf/diag-alloca-1.c: Adjust 'dg-message'. * gcc.target/bpf/diag-alloca-2.c: Likewise. * gcc.target/nvptx/alloca-1-O0-sm_30.c: Likewise. * gcc.target/nvptx/alloca-2-O1-sm_30.c: Likewise. * gcc.target/nvptx/vla-1-O0-sm_30.c: Likewise. * lib/target-supports.exp (proc check_effective_target_alloca): Adjust comment. (cherry picked from commit 2abc942fd486be217de1ba0282a3dc8e21d599aa) Diff: --- gcc/ChangeLog.omp | 10 ++++++++++ gcc/config/bpf/bpf.md | 5 ++--- gcc/config/nvptx/nvptx.md | 2 +- gcc/testsuite/ChangeLog.omp | 13 +++++++++++++ gcc/testsuite/gcc.target/bpf/diag-alloca-1.c | 3 ++- gcc/testsuite/gcc.target/bpf/diag-alloca-2.c | 4 +++- gcc/testsuite/gcc.target/nvptx/alloca-1-O0-sm_30.c | 2 +- gcc/testsuite/gcc.target/nvptx/alloca-2-O1-sm_30.c | 2 +- gcc/testsuite/gcc.target/nvptx/vla-1-O0-sm_30.c | 2 +- gcc/testsuite/lib/target-supports.exp | 2 +- 10 files changed, 35 insertions(+), 10 deletions(-) diff --git a/gcc/ChangeLog.omp b/gcc/ChangeLog.omp index e551fa81a6dc..f46a06d4e1ed 100644 --- a/gcc/ChangeLog.omp +++ b/gcc/ChangeLog.omp @@ -1,3 +1,13 @@ +2025-02-27 Thomas Schwinge <tschwi...@baylibre.com> + + Backported from trunk: + 2025-02-22 Thomas Schwinge <tschwi...@baylibre.com> + + * config/bpf/bpf.md (define_expand "allocate_stack"): Emit + 'sorry, unimplemented: dynamic stack allocation not supported'. + * config/nvptx/nvptx.md (define_expand "allocate_stack") + [!TARGET_SOFT_STACK && !(TARGET_PTX_7_3 && TARGET_SM52)]: Likewise. + 2025-02-18 Thomas Schwinge <tschwi...@baylibre.com> Backported from trunk: diff --git a/gcc/config/bpf/bpf.md b/gcc/config/bpf/bpf.md index 95859328d254..57101261c2b2 100644 --- a/gcc/config/bpf/bpf.md +++ b/gcc/config/bpf/bpf.md @@ -121,12 +121,11 @@ [(match_operand:DI 0 "general_operand" "") (match_operand:DI 1 "general_operand" "")] "" - " { - error (\"BPF does not support dynamic stack allocation\"); + sorry ("dynamic stack allocation not supported"); emit_insn (gen_nop ()); DONE; -}") +}) ;;;; Arithmetic/Logical diff --git a/gcc/config/nvptx/nvptx.md b/gcc/config/nvptx/nvptx.md index a9c7a6d6924e..c231c7ea0067 100644 --- a/gcc/config/nvptx/nvptx.md +++ b/gcc/config/nvptx/nvptx.md @@ -1698,7 +1698,7 @@ emit_insn (gen_nvptx_alloca (Pmode, operands[0], operands[1])); else if (!TARGET_SOFT_STACK) { - sorry ("target cannot support alloca"); + sorry ("dynamic stack allocation not supported"); emit_insn (gen_nop ()); } else if (TARGET_SOFT_STACK) diff --git a/gcc/testsuite/ChangeLog.omp b/gcc/testsuite/ChangeLog.omp index 3fea26738e9e..230ec62f80ee 100644 --- a/gcc/testsuite/ChangeLog.omp +++ b/gcc/testsuite/ChangeLog.omp @@ -1,3 +1,16 @@ +2025-02-27 Thomas Schwinge <tschwi...@baylibre.com> + + Backported from trunk: + 2025-02-22 Thomas Schwinge <tschwi...@baylibre.com> + + * gcc.target/bpf/diag-alloca-1.c: Adjust 'dg-message'. + * gcc.target/bpf/diag-alloca-2.c: Likewise. + * gcc.target/nvptx/alloca-1-O0-sm_30.c: Likewise. + * gcc.target/nvptx/alloca-2-O1-sm_30.c: Likewise. + * gcc.target/nvptx/vla-1-O0-sm_30.c: Likewise. + * lib/target-supports.exp (proc check_effective_target_alloca): + Adjust comment. + 2025-02-18 Thomas Schwinge <tho...@codesourcery.com> Backported from trunk: diff --git a/gcc/testsuite/gcc.target/bpf/diag-alloca-1.c b/gcc/testsuite/gcc.target/bpf/diag-alloca-1.c index 0406f2c35958..e549cab84caf 100644 --- a/gcc/testsuite/gcc.target/bpf/diag-alloca-1.c +++ b/gcc/testsuite/gcc.target/bpf/diag-alloca-1.c @@ -3,7 +3,8 @@ int foo (int x) { - int *p = __builtin_alloca (x); /* { dg-error "support" } */ + int *p = __builtin_alloca (x); + /* { dg-message {sorry, unimplemented: dynamic stack allocation not supported} {} { target *-*-* } .-1 } */ return p[2]; } diff --git a/gcc/testsuite/gcc.target/bpf/diag-alloca-2.c b/gcc/testsuite/gcc.target/bpf/diag-alloca-2.c index ef7170b2c3d3..b1084bf57268 100644 --- a/gcc/testsuite/gcc.target/bpf/diag-alloca-2.c +++ b/gcc/testsuite/gcc.target/bpf/diag-alloca-2.c @@ -4,6 +4,8 @@ int foo (int x) { - int arr[x]; /* { dg-error "support" } */ + int arr[x]; + /* { dg-message {sorry, unimplemented: dynamic stack allocation not supported} {} { target *-*-* } .-1 } */ + return arr[3]; } diff --git a/gcc/testsuite/gcc.target/nvptx/alloca-1-O0-sm_30.c b/gcc/testsuite/gcc.target/nvptx/alloca-1-O0-sm_30.c index 0a969a9b8460..eb4034ae93ed 100644 --- a/gcc/testsuite/gcc.target/nvptx/alloca-1-O0-sm_30.c +++ b/gcc/testsuite/gcc.target/nvptx/alloca-1-O0-sm_30.c @@ -7,5 +7,5 @@ void sink(void *); void f(void) { sink(__builtin_alloca(123)); - /* { dg-message {sorry, unimplemented: target cannot support alloca} {} { target *-*-* } .-1 } */ + /* { dg-message {sorry, unimplemented: dynamic stack allocation not supported} {} { target *-*-* } .-1 } */ } diff --git a/gcc/testsuite/gcc.target/nvptx/alloca-2-O1-sm_30.c b/gcc/testsuite/gcc.target/nvptx/alloca-2-O1-sm_30.c index 9256387b532b..2294e41d740f 100644 --- a/gcc/testsuite/gcc.target/nvptx/alloca-2-O1-sm_30.c +++ b/gcc/testsuite/gcc.target/nvptx/alloca-2-O1-sm_30.c @@ -6,5 +6,5 @@ int main(void) { return !(__builtin_alloca(100) != __builtin_alloca(10)); - /* { dg-message {sorry, unimplemented: target cannot support alloca} {} { target *-*-* } .-1 } */ + /* { dg-message {sorry, unimplemented: dynamic stack allocation not supported} {} { target *-*-* } .-1 } */ } diff --git a/gcc/testsuite/gcc.target/nvptx/vla-1-O0-sm_30.c b/gcc/testsuite/gcc.target/nvptx/vla-1-O0-sm_30.c index d25ad2e87b9c..b19b13c8ac94 100644 --- a/gcc/testsuite/gcc.target/nvptx/vla-1-O0-sm_30.c +++ b/gcc/testsuite/gcc.target/nvptx/vla-1-O0-sm_30.c @@ -7,6 +7,6 @@ void sink(void *); void f(int s) { char a[s]; - /* { dg-message {sorry, unimplemented: target cannot support alloca} {} { target *-*-* } .-1 } */ + /* { dg-message {sorry, unimplemented: dynamic stack allocation not supported} {} { target *-*-* } .-1 } */ sink(a); } diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp index a8d2a9a39fc3..21a9861e392e 100644 --- a/gcc/testsuite/lib/target-supports.exp +++ b/gcc/testsuite/lib/target-supports.exp @@ -987,7 +987,7 @@ proc check_effective_target_untyped_assembly {} { return 1 } -# Return 1 if alloca is supported, 0 otherwise. +# Return 1 if dynamic stack allocation is supported, 0 otherwise. proc check_effective_target_alloca {} { if { [istarget bpf-*-*] } {