Using -std=legacy is a reasonable way to deal with the problem. This new feature of GCC 10 is clearly buggy: it incorrectly rejects calls involving %VAL() (as seen in some PGPLOT drivers, for instance). Changing the Fortran code is not always the right way out.