This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug fortran/45466] Bus Error: C program calls Fortran Function which has returned value as Character string



------- Comment #2 from kargl at gcc dot gnu dot org  2010-08-31 17:53 -------
Try compiling with -fdump-tree-original and inspecting the 
expected argument lists.  You really don't want to use a
function here.  Use a subroutine.

include <stdio.h>

void requestdouble_(double*, double*, char *, int *len);

int main()
{
    char str[20];
    int len;
    double lat=10.0;
    double lon=20.0;
    requestdouble_(&lat, &lon, str, &len);
    return 0;
}
subroutine requestdouble(rlat,rlng,str)
  IMPLICIT NONE
  REAL(KIND=8), INTENT(IN) :: rlat ! - latitude -
  REAL(KIND=8), INTENT(IN) :: rlng ! - longitude -
  CHARACTER(LEN=*) :: str
  PRINT *, ' requestdouble rlat=', rlat,' rlng=', rlng
  str='1111111111111111'
  RETURN
END subroutine requestdouble


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45466


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]