http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56261
janus at gcc dot gnu.org changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |wrong-code CC| |janus at gcc dot gnu.org Summary|seg fault call procedure |[OOP] seg fault call |pointer on polymorphic |procedure pointer on |array |polymorphic array --- Comment #2 from janus at gcc dot gnu.org 2013-02-09 09:52:54 UTC --- (In reply to comment #1) > allocate(c(10)) > call f(c) Adding in here a call to "ff(c)", the dump reveals the difference between the two calls: static struct __class_t_Nc_1_0a c = {}; static void (*<T4f8>) () f = ff; [..] __builtin_memset (c._data.data, 0, 40); c._data.dtype = 297; c._data.dim[0].lbound = 1; c._data.dim[0].ubound = 10; c._data.dim[0].stride = 1; c._data.offset = -1; (struct __vtype_t_Nc *) c._vptr = &__vtab_t_Nc; { struct __class_t_Nc_1_0 class.2; class.2._data = VIEW_CONVERT_EXPR<struct array1_nc>(c._data); class.2._vptr = c._vptr; ff (&class.2); } f ((struct nc[0:] * restrict) c._data.data); The first part simply sets up the array descriptor for c after the allocation. Then comes the call to 'ff' (in curly brackets), which is done correctly (although I'm not quite sure why the temporary 'class.2' is needed). In the call to 'f', we wrongly pass c._data.data, while we should rather pass 'c' as a whole (or with a temporary as in the 'ff' case?).