This is the mail archive of the gcc-patches@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]

Re: Patch to gfortran PR13433


On Sunday 15 February 2004 11:40 am, Victor Leikehman wrote:
> This patch fixes gfortran/13433 aka "ICE in assumed-length
> character function".
> (http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13433)

Applied, thanks. Something seems to have mangled the whitespace in the patch, 
so I made the changes by hand.

In future please put ChangeLog entries in plain test in the body of the email, 
not as part of the patch. Patches to gfortran should also be copied to 
fortran@gcc.gnu.org.

> For functions returning CHARACTER, calling conventions
> changed to comply with g77.
>
> Follows an example that used to trigger the ICE;
> now prints HELLO WORLD as expected.
>
>       CHARACTER*11 FUNCTION G()
>         G = "HELLO"
>       END
>
>       CHARACTER*(*) FUNCTION F()
>         F = "WORLD"
>       END
>
>       PROGRAM MAIN
>       CHARACTER*5 F,G
>         PRINT*, G(), ' ', F()
>       END
>
>    Victor

The above gode is illegal. It can (and does) cause memory corruption. The 
dummy result for G() is larger then the actual result.

Paul

2004-02-15  Victor Leikehman  <lei@il.ibm.com>

	PR gfortran/13433
	* trans-decl.c (gfc_build_function_decl) For functions
	returning CHARACTER*(*) pass an extra length argument,
	following g77 calling conventions.
	* trans-types.c (gfc_get_function_type) Ditto.
	* trans-expr.c (gfc_conv_function_call) Ditto.

2004-02-15  Paul Brook  <paul@codesourcery.com>

	PR gfortran/13433
	* gfortran.fortran-torture/execute/straret.f90: New test.


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