On Thu, Mar 27, 2025 at 06:11:25PM +0000, Sam James wrote: > >> diff --git a/gcc/testsuite/gfortran.dg/cray_pointers_2.f90 > >> b/gcc/testsuite/gfortran.dg/cray_pointers_2.f90 > >> index 4351874825ed..a7e15bad850a 100644 > >> --- a/gcc/testsuite/gfortran.dg/cray_pointers_2.f90 > >> +++ b/gcc/testsuite/gfortran.dg/cray_pointers_2.f90 > >> @@ -1,6 +1,6 @@ > >> ! Using two spaces between dg-do and run is a hack to keep > >> gfortran-dg-runtest > >> ! from cycling through optimization options for this expensive test. > >> -! { dg-do run } > >> +! { dg-do run } > >> ! { dg-options "-O3 -fcray-pointer -fbounds-check -fno-inline" } > >> ! { dg-timeout-factor 4 } > >> ! > > > > There was an attempt by Jerry some time ago to have a directive > > for not cycling through options, but this is not yet available. > > Ah, PR28032.
There already is a documented directive which can do that. As documented, dg-skip-if allows to skip a test if some option appears in the list (e.g. cycle through everything but skip the test with -O2) or skip unless all the options from a string are included. The following patch runs the test only in the -O3 -g case (just using -O3 there would run it twice, once with -O3 -fomit-frame-pointer -funroll-loops -fpeel-loops -ftracer -finline-functions and once with -O3 -g The -O3 from dg-options can be dropped too. Some tests (e.g. in testsuite/gcc.dg/torture/) use e.g. /* { dg-skip-if "" { ! run_expensive_tests } { "*" } { "-O2" } } */ so the test is run just with -O2 by default, but when testing with GCC_TEST_RUN_EXPENSIVE=1 it cycles through everything. Note, you'd need to drop the -O3 from dg-options in that case for sure, because with explicit -O3 option in there it cycles through -O0 -O3, -O1 -O3, -O2 -O3, -O3 -fomit-frame-pointer -funroll-loops -fpeel-loops -ftracer -finline-functions -O3, -O3 -g -O3, -Os -O3. Ok for trunk? Or do you want the ! run_expensive_tests version? 2025-03-27 Jakub Jelinek <ja...@redhat.com> * gfortran.dg/cray_pointers_2.f90: Replace { dg-do run } hack with dg-skip-if directive. --- gcc/testsuite/gfortran.dg/cray_pointers_2.f90.jj 2020-01-12 11:54:38.207386342 +0100 +++ gcc/testsuite/gfortran.dg/cray_pointers_2.f90 2025-03-27 19:23:29.237873386 +0100 @@ -1,6 +1,5 @@ -! Using two spaces between dg-do and run is a hack to keep gfortran-dg-runtest -! from cycling through optimization options for this expensive test. -! { dg-do run } +! { dg-do run } +! { dg-skip-if "Don't cycle through options" { *-*-* } { "*" } { "-O3 -g" } } ! { dg-options "-O3 -fcray-pointer -fbounds-check -fno-inline" } ! { dg-timeout-factor 4 } ! Jakub