Question about structures,intent(in),pointer elements

Steve Kargl sgk@troutmask.apl.washington.edu
Mon Feb 3 04:42:00 GMT 2014


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.

-- 
Steve



More information about the Fortran mailing list