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

kargl at gcc dot gnu dot org gcc-bugzilla@gcc.gnu.org
Tue Aug 31 19:09:00 GMT 2010



------- Comment #6 from kargl at gcc dot gnu dot org  2010-08-31 19:09 -------
(In reply to comment #5)

> Thanks. I do know how to work around it with subroutine which I already did in
> my program. But it doesn't explain why 4.1.2 version allows return character
> string from function. Our program works well until the gcc upgrade. 
> Is this new standard?

I don't know what you mean by 'new standard'.  

I have gfortran 4.3.x, 4.4.x, 4.5.x, and 4.6.0 installed. 
-fdump-tree-original for these compilers  all show 

4.3

requestdouble (__result, .__result, rlat, rlng)

4.4, 4.5, and 4.6:

requestdouble (character(kind=1)[1:.__result] & __result,
 integer(kind=4) .__result, real(kind=8) & rlat,
 real(kind=8) & rlng)

The first returned argument is a pointer to the string
and the second returned argument is the length.

I don't know what 4.1 and 4.2 do.  You're clearly 
(ab)using the abi to do mixed language program,
and you need to investigate the calling conventions
when you have problems.


-- 
steve


-- 


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



More information about the Gcc-bugs mailing list