------- Additional Comments From tobi at gcc dot gnu dot org 2005-07-09 11:47 ------- For the record, in the testcase Paul posted together with his patch <http://gcc.gnu.org/ml/fortran/2005-07/msg00098.html>, we call foo as follows: struct array1_real4 parm.11; struct array1_mytype parm.10;
parm.10.dtype = 553; parm.10.dim[0].lbound = 1; parm.10.dim[0].ubound = 4; parm.10.dim[0].stride = 1; parm.10.data = (void *) (struct mytype[0:] *) &z[0]; parm.10.offset = 0; parm.11.dtype = 281; parm.11.dim[0].lbound = 1; parm.11.dim[0].ubound = 4; parm.11.dim[0].stride = 1; parm.11.data = (void *) (real4[0:] *) &b[0]; parm.11.offset = 0; foo (&parm.10, &parm.11); So instead of setting up an array which points to the x (or y) components of z, we pass z as a whole, which of course doesn't make sense. There seem to be two possible solutions: - use a temporary. This is what Paul's patch does (even though there should be a more intuitive way to check for this case, and there are probably other cases where we incorrectly assume that stuff is contiguous) - setup an array descriptor which points to the right parts of the array, in our case this would be (if I get it right): parm.10.dtype = 281; parm.10.dim[0].lbound = 1; parm.10.dim[0].ubound = 4; parm.10.dim[0].stride = 2; /* Increased stride to walk past y component */ parm.10.data = (void *) (struct real4[0:] *) &z[0].x; parm.10.offset = 0; for the x component, and parm.10.dtype = 281; parm.10.dim[0].lbound = 1; parm.10.dim[0].ubound = 4; parm.10.dim[0].stride = 2; /* Increased stride to walk past y component */ parm.10.data = (void *) (struct real4[0:] *) &z[0].y; parm.10.offset = 0; for the y component. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18022