https://gcc.gnu.org/bugzilla/show_bug.cgi?id=123025
--- Comment #11 from Steve Kargl <kargl at gcc dot gnu.org> ---
(In reply to anlauf from comment #10)
> Since the old-style declarations were used in legacy code,
> I thought about auditing the affected testcases and adding
>
> ! { dg-additional-options "-std=legacy" }
>
> where appropriate to also indicate that this is legacy code, as we might
> change the default warnings emitted with -std=gnu in the future.
>
> However, I learned that -pedantic seems to ignore -std=legacy.
>
> Would it make sense to ignore -pedantic when -std=legacy is specified?
Answering the question first, 'yes'. The combination of -pedantic -std=legacy
certainly seems odd. Now, onto the DEFAULT_FFLAGS.
% find . -name \*exp | xargs grep 'set DEFAULT_FFLAGS' | grep pedantic
gcc/testsuite/gcc.target/powerpc/ppc-fortran/ppc-fortran.exp
gcc/testsuite/gcc.target/s390/s390.exp
gcc/testsuite/gfortran.dg/coarray/caf.exp
gcc/testsuite/gfortran.dg/dg.exp
gcc/testsuite/gfortran.dg/ieee/ieee.exp
The dejagnu scripts contain
# If a testcase doesn't have special options, use these.
global DEFAULT_FFLAGS
if ![info exists DEFAULT_FFLAGS] then {
set DEFAULT_FFLAGS " -pedantic-errors"
}
Note, gcc/testsuite/gfortran.dg/analyzer/analyzer.exp manipulates
DEFAULT_FFLAGS and removes -pedantic-errors, but adds it own set
of options.
In my testing, I found a few failing testcases that
already contain a '{ dg-options "-std=fXXXX" }' and
definitely were not legacy code. We would need to
change the old-style declarations.
I tried adding 'unset DEFAULT_FFLAGS' after the above
block, but that led to a different set of failures.
Likely, testcases catching errors from -pedantic-errors
that are not relevant to the actual testcase.
Jerry's idea of adding changing ' -pedantic-errors'
to ' -O0' may be problematic. The option is added
to the other options during testing. If it occurs
after -O1 or higher optimization, it essentially
nullifies the testing with optimization. I need to
look more closely at this.
So far, adding '{ dg-options " "}' to testcases
seems to work.