------- Comment #3 from remko dot scharroo at me dot com  2010-06-11 18:22 
-------
I fully agree that the second "deallocate (p2, stat=ios)" is a violation.
That is the actual intend of this program.
You know, this is not arbitrary code. You can often have multiple pointers
pointing to allocated memory, and then you want to deallocate the memory.
Then you need to do multiple "deallocate" statements.
You cannot do it any other way, since you cannot test "if (allocated)" since
the pointer is not "allocatable".
Therefore, the best try is to simply deallocate all the pointers, i.e.,
"deallocate (p2, stat=ios)"

Reading your excerpt from the F2003 standards, it does, of course, shows the
violation. But then I expect ios simply to be non-zero, not get an abort.

For example, I read in Stephan J. Chapman "Fortran 90/95 for scientists and
engineers", p 635 "If the pointer in the statement happens to point to a target
not created with an ALLOCATE statement, then the DEALLOCATE statement fails and
the program aborts UNLESS THE STAT= CLAUSE WAS SPECIFIED" (emphasis is mine).


-- 


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

Reply via email to