parsec icon indicating copy to clipboard operation
parsec copied to clipboard

LTO build failure

Open Alessandro-Barbieri opened this issue 3 years ago • 1 comments

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

Alessandro-Barbieri avatar Jul 24 '22 20:07 Alessandro-Barbieri

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.

omor1 avatar Aug 10 '22 08:08 omor1