Following the discussion about ABI compatibility and type-punning of non
client-visible types, I've attached a patch against 1.3.2 which casts to
an opaque (void *) when OMPI_BUILDING is 0.
This will prevent the compiler from trying to do any strict-aliasing
based optimizations when the definition of the type to cast to is unknown.
When builing Open MPI, the (void *) cast is omitted (because of the
compiler flag "-DOMPI_BUILDING=1") and the code remains as before.
This clears up all warnings for my GCC 4.1 compiler.
>> Ultimately, for internal use, the (void *) is bad, but from client
>> with no knowledge of your types, it should be mandatory and tells the
>> compiler to make no assumptions about aliasing.
> I think you're convincing me, but I need to think over this a little
> I wonder if we should have a "smart" #define for MPI_COMM_WORLD that
> puts the (void*) in when compiling user codes, and doesn't include it
> when building OMPI itself (i.e., so that we can get the debugging
> benefit of proper type checking when building OMPI). We do have the
> OMPI_BUILDING macro in opal_config_bottom.h that could be used to
> switch the macro definition. Hrm...