------- Comment #13 from burnus at gcc dot gnu dot org 2010-01-28 18:44 ------- (In reply to comment #11) > I get a suspicious error: > > Error: The NULL in the derived type constructor at (1) is being applied to > component 'ptr', which is neither a POINTER nor ALLOCATABLE
The problem is that for both type(c_ptr) :: ptr => C_NULL_PTR and for integer, pointer :: ptr => null() the expression type EXPR_NULL is used. At some point when going from the front-end representation (gfc_symbol, gfc_expr) to the middle-end representation (tree), the derived type non-pointer "type(c_ptr)" will be converted to a scalar pointer. Seemingly, by moving code from resolve.c to trans*.c you have an ordering problem with regards to type(c_(fun)ptr). -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42888