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 Sun, Feb 15, 2004 at 04:49:41PM +0000, Paul Brook wrote:
> On Sunday 15 February 2004 11:40 am, Victor Leikehman wrote:
> >
> > 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.
> 

I'm not sure its illegal.  NAG compiles the code.  It 
however produces a run time error.

kargl[206] f95 -o z z.f90
Obsolescent: z.f90, line 7: Assumed-length CHARACTER function
kargl[207] ./z
CHARACTER function called with LEN=5 but should be LEN=11
Program terminated by fatal error
Abort (core dumped)

-- 
Steve


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