Question about structures,intent(in),pointer elements
Steve Kargl
sgk@troutmask.apl.washington.edu
Mon Feb 3 14:26:00 GMT 2014
On Mon, Feb 03, 2014 at 09:48:55AM +0200, Rimvydas Jasinskas wrote:
> On Mon, Feb 3, 2014 at 6:42 AM, Steve Kargl
> <sgk@troutmask.apl.washington.edu> wrote:
> > On Sun, Feb 02, 2014 at 11:43:16AM +0200, Rimvydas Jasinskas wrote:
> >> > So you don't want to be able to change the value of your argument but
> >> > you want to be able to deallocate/retarget it?
> >> > I don't think it's possible; at least it would go against the principle
> >> > of INTENT(IN) which tells: this value doesn't change.
> >>
> >> No, that would be pointless. I want to get more diagnostics.
> >> Code is not mine and it is written by c thinking windows developers...
> >> I just there to bugfix and make it portable to linux.
> >> Basically re factoring and adding intents,diagnostics.
> >> gfortran 4.8.x was very helpful so far.
> >> Attach very simplified full example.
> >> While it should be technically legal under f2003, yet in most cases
> >> this is becomes a bug in code.
> >>
> >> So again questions:
> >> 1) should code be legal with -std=f95?
> >> 2) more like feature request, is it useful to add warning for
> >> definition context with intent(in) under -Wsurprising?
> >> "Warning: Dummy argument 'bar' with INTENT(IN) in variable definition
> >> context (assignment) at (1)"
> >>
> >
> > Your code is invalid Fortran, and the first problem
> > (and the one at which I stopperd reading your code)
> > is not required to be reported by the Fortran standard.
> > The code that makes your example invalid is a prohibition
> > for the programmer and not the compiler.
> >
>
> Thank you for clarification.
>
CC'd to fortran@
Please do not send me private emails on threads from fortran@.
Use "replay all" Thanks.
The problem that I alluded to cannot be diagnosed at compile.
It would require a runtime check and at this point in time
that may be a large change in the internal structure of
gfortran. To be blunt, one of the subroutines in your
example referenced an undefined entity. The Fortran
standard prohits this, and this prohibition if for the
programmer.
--
Steve
More information about the Fortran
mailing list