From: Thomas Schwinge Date: Fri, 21 Feb 2025 10:21:08 +0000 (+0100) Subject: BPF, nvptx: Standardize on 'sorry, unimplemented: dynamic stack allocation not supported' X-Git-Tag: basepoints/gcc-16~1880 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=2abc942fd486be217de1ba0282a3dc8e21d599aa;p=thirdparty%2Fgcc.git 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-sm_30.c: Likewise. * gcc.target/nvptx/vla-1-sm_30.c: Likewise. * lib/target-supports.exp (proc check_effective_target_alloca): Adjust comment. --- diff --git a/gcc/config/bpf/bpf.md b/gcc/config/bpf/bpf.md index 12cf9fae855..91d94838e39 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 d3d538070c0..e7d3630d4c4 100644 --- a/gcc/config/nvptx/nvptx.md +++ b/gcc/config/nvptx/nvptx.md @@ -1677,7 +1677,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/gcc.target/bpf/diag-alloca-1.c b/gcc/testsuite/gcc.target/bpf/diag-alloca-1.c index 0406f2c3595..e549cab84ca 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 ef7170b2c3d..b1084bf5726 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-sm_30.c b/gcc/testsuite/gcc.target/nvptx/alloca-1-sm_30.c index 261a603ec4c..5538751035b 100644 --- a/gcc/testsuite/gcc.target/nvptx/alloca-1-sm_30.c +++ b/gcc/testsuite/gcc.target/nvptx/alloca-1-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/vla-1-sm_30.c b/gcc/testsuite/gcc.target/nvptx/vla-1-sm_30.c index 2bf2c91d60e..7c2d2e0e35b 100644 --- a/gcc/testsuite/gcc.target/nvptx/vla-1-sm_30.c +++ b/gcc/testsuite/gcc.target/nvptx/vla-1-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 9b5fbe52756..7eab76a7eb6 100644 --- a/gcc/testsuite/lib/target-supports.exp +++ b/gcc/testsuite/lib/target-supports.exp @@ -1002,7 +1002,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-*-*] } {