Re: [PATCH 3/7] testsuite: require stack protector support in no-stack-protector-attr.C

Andrea Pinski <[email protected]>
Newsgroups gmane.comp.gcc.patches
Message-ID <CALvbMcC1vcZehX_duyMF3bkY8OATLNJ2vFEsqYDBbXVLCN1fsQ@mail.gmail.com>
On Fri, Aug 14, 2026 at 12:31 PM Matt Turner <[email protected]> wrote:
>
> The test carried two dg-do compile directives: one restricting it to x86
> and, added later, one excluding only hppa.  DejaGnu honors the last one, so
> the x86 restriction never had any effect and the test has run everywhere
> since it was added, which is why hppa needed excluding at all.
>
> Require fstack_protector instead, so the test runs wherever the feature
> exists.  This fixes it on alpha, which does not support -fstack-protector
> and warns that the option is unsupported.  The hppa exclusion becomes
> redundant, as check_effective_target_fstack_protector already returns 0
> there.
>
> gcc/testsuite/ChangeLog:
>
>         * g++.dg/no-stack-protector-attr.C: Remove the dead dg-do directive
>         and the hppa exclusion, and require fstack_protector.

Ok.

> ---
>  gcc/testsuite/g++.dg/no-stack-protector-attr.C | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
>
> diff --git ./gcc/testsuite/g++.dg/no-stack-protector-attr.C ./gcc/testsuite/g++.dg/no-stack-protector-attr.C
> index 3314a94bd7b..a285c551795 100644
> --- ./gcc/testsuite/g++.dg/no-stack-protector-attr.C
> +++ ./gcc/testsuite/g++.dg/no-stack-protector-attr.C
> @@ -1,11 +1,10 @@
>  /* PR c/94722 */
>  /* Test that stack protection is disabled via no_stack_protector attribute. */
>
> -/* { dg-do compile { target i?86-*-* x86_64-*-* } } */
> +/* { dg-do compile } */
> +/* { dg-require-effective-target fstack_protector } */
>  /* { dg-options "-O2 -fstack-protector-all" } */
>
> -/* { dg-do compile { target { ! hppa*-*-* } } } */
> -
>  int __attribute__((no_stack_protector)) c()
>  {
>    int a;
> --
> 2.54.0
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.