parsec
parsec copied to clipboard
LTO build failure
Describe the bug
error: type of ‘parsec_context_test_f08’ does not match original declaration [-Werror=lto-type-mismatch]
To Reproduce
Steps to reproduce the behavior:
add -flto -Werror=odr -Werror=lto-type-mismatch -Werror=strict-aliasing to C*FLAGS
Expected behavior
correctly build with LTO
Environment (please complete the following information):
- PaRSEC version: 3.0.2012
- OS: gentoo
- Compiler: gcc-12.1.1
- MPI version: openmpi-4.1.4
Additional context
log https://860771.bugs.gentoo.org/attachment.cgi?id=794063 bug https://bugs.gentoo.org/860771
My brief understanding of this is that parsecf.F90 declares parsec_context_t to be a type, compatible with C, with a single member, named PTR, of type C_PTR. That is to say, parsec_context_t is declared to be a type compatible with struct { void *ptr; };. This is then used as the formal parameter for all functions in the Fortran wrapper interface that have a parsec_context_t * parameter in the C interface. This is done primarily, I think, as an indication to users of what pointer should be passed.
I think that this might technically violate the letter of the standard, but should be safe everywhere—I struggle to think of a situation where it might not be. Maybe a platform where the alignment of a structure containing a pointer and that of the pointer itself is different?
For what it's worth, I compile and use PaRSEC with LTO daily, though compiled with an LLVM/Clang downstream, not GCC.