On Sat, 17 Oct 2015, VandeVondele Joost wrote:
I would like to run coverage tests at '-O1' (using -coverage and lcov,
gaining >2x time over -O0), but unfortunately unused functions (e.g.
static functions not called) are removed from the coverage report at
-O1, which otherwise looks good to me.
So, the question: is there a way to compile at -O1 but keep all
functions ? (i tried -fno-tree-dce but that didn't help). Bonus points
if this also works for Fortran. (I'm aware of -Wunused-functions, but
this doesn't fit the requirements).
-fkeep-inline-functions is the closest I know, but it doesn't apply to
your example because the function is not marked inline. I don't know what
internal representation is used for fortran, so I don't know if it would
work there. If you could patch the program, some __attribute__((used))
would help. If you are willing to patch gcc, look in cgraphunit.c where
flag_keep_inline_functions is used and try removing the check for inline.
I have also missed this functionality in the past. If there isn't a PR
about it, it would be good to open one.
--
Marc Glisse