(j3.2006) Deallocation of associated pointers
Lionel, Steve
steve.lionel
Tue Feb 12 15:57:42 EST 2013
Hmm - I thought we had taken care of this a long time ago. Guess not. I'll let the team know.
Steve Lionel
Intel Developer Support
Merrimack, NH
-----Original Message-----
From: j3-bounces at mailman.j3-fortran.org [mailto:j3-bounces at mailman.j3-fortran.org] On Behalf Of Bill Long
Sent: Tuesday, February 12, 2013 3:46 PM
To: fortran standards email list for J3
Cc: pmarguinaud at hotmail.com
Subject: Re: (j3.2006) Deallocation of associated pointers
The code looks OK (valid) to me. I tried three other compilers and all produced
> ./a.out
IERR/Y1 = 0
IERR/Y2 = 0
as the output. Intel would probably appreciate a bug report.
Cheers,
Bill
On 2/11/13 12:47 AM, philippe marguinaud wrote:
> Hi all,
>
> I have a question about deallocating a pointer which was associated
> with an allocated target; Fortran standard says (ISO/IEC FCD
> 1539-1:2004
> 6.3.3.2) :
>
> "If a pointer appears in a DEALLOCATE statement, it shall be
> associated with the whole of an object that was created by allocation."
>
> When compiled with ifort, the following piece of code produces an
> error for the second deallocate statement :
>
> PROGRAM MAIN
> CALL TOTO (100)
> CONTAINS
> SUBROUTINE TOTO (N)
> REAL, POINTER :: X1 (:), Y1 (:)
> REAL, POINTER :: X2 (:), Y2 (:)
> ALLOCATE (X1 (1:N), X2 (1:N))
> Y1 => X1
> Y2 => X2 (1:N)
> DEALLOCATE (Y1, STAT = IERR)
> WRITE (0, *) " IERR/Y1 = ", IERR
> DEALLOCATE (Y2, STAT = IERR)
> WRITE (0, *) " IERR/Y2 = ", IERR
> END SUBROUTINE TOTO
> END
>
> $ ifort alloc.F90
> $ ./a.out
> IERR/Y1 = 0
> IERR/Y2 = 173
>
> Is the Intel compiler right, or is the second deallocate valid Fortran ?
>
> Best regards,
>
> Philippe Marguinaud
>
>
>
> _______________________________________________
> J3 mailing list
> J3 at mailman.j3-fortran.org
> http://mailman.j3-fortran.org/mailman/listinfo/j3
>
--
Bill Long longb at cray.com
Fortran Technical Support & voice: 651-605-9024
Bioinformatics Software Development fax: 651-605-9142
Cray Inc./Cray Plaza, Suite 210/380 Jackson St./St. Paul, MN 55101
_______________________________________________
J3 mailing list
J3 at mailman.j3-fortran.org
http://mailman.j3-fortran.org/mailman/listinfo/j3
More information about the J3
mailing list