HomePhabricator

[flang] Limits C++ implementation behaviors

Authored by jeanPerier on Mar 1 2019, 4:27 AM.

Description

[flang] Limits C++ implementation behaviors

The issue addressed here is the use of cast between object pointers
and function pointers. It is implementation defined because C++,
just like C, does not mandate that function and object pointers
must have the same size.
It is needed to have such cast because it is a will to ba able to
call inside F18 numerical function from libraries linked during
a Fortran program compilation in order to perform folding.
dlopen returns function pointers as void* that need to be cast to
pointer before use.
This change limits the usage of such cast inside ifdefs where POSIX
is required. In POSIX context, such cast is defined. Dlopen is
anyway used only if the environment is POSIX compliant.
In the rest of the code, opaque function pointers have been changed
from void* to void*(*)(). reinterpret_cast from function pointer to
function pointer are standard compliant.

Original-commit: flang-compiler/f18@4b2f29a1289e955469c9b9778a7db0034b0fce70
Tree-same-pre-rewrite: false

Details

Committed
GitHub <noreply@github.com>Mar 27 2019, 10:16 AM
Parents
rGdd2c2d579866: [flang] fixed use before init in elemental folding helper
Branches
Unknown
Tags
Unknown

Event Timeline