On Thu, Mar 27, 2025 at 07:34:14PM +0100, Jakub Jelinek wrote: > 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.
Though, seeing 395 gfortran.dg/*.f90 tests with dg-options or dg-additional-options including -O, perhaps better might be to hack up the gfortran.dg/dg.exp and libgomp.fortran/fortran.exp drivers so that they actually don't cycle through options if -O appears anywhere in dg-options/dg-additional-options. What do you think about that? For gcc.dg/torture/ and g++.dg/torture/, IMHO explicit -O in dg-options/dg-additional-options is always a bug, either the test shouldn't be in torture subdirectory and have the explicit -O, or it shouldn't have them and cycle through everything. But in gfortran.dg case when the default is to cycle for all tests... Jakub