[Patch, Fortran] PR 46974: Handle C_(FUN)PTR variables in TRANSFER
Tobias Burnus
burnus@net-b.de
Sat Dec 18 20:28:00 GMT 2010
The patch adds compile-time simplification support for C_PTR/C_FUNPTR
variables. Those are special beasts as they are derived types in Fortran
(gfc_expr/gfc_symbol) but for the middle end (tree) they are simple
(function) pointers.
The patch add special treatment to the <transfer bits> ->
C_(FUN)PTR-type conversion in target-memory.c - and it handles them
explicitly in assignment. I removed the bits about C_NULL_PTR which
seems to be dead code. I believe the function is never called for
C_NULL_PTR as the conversion to an c_intptr_t-like integer happens
earlier. Additionally, even if for C_NULL_PTR the code block would be
entered, there were a segfault as the component->backend_decl is NULL.
-- At least that's how I read gfc_get_derived_type.
Build and regtested on x86-64-linux.
OK for the trunk?
Tobias
PS: I wrote in the PR that one should try to avoid the special handling
- obviously, I failed. However, the patch at least fixes the PR and
allows compile-time simplification.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: c_ptr.diff
Type: text/x-patch
Size: 5799 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20101218/0562be76/attachment.bin>
More information about the Gcc-patches
mailing list