- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The code below, as is, will compile and create the following error at runtime: "forrtl: severe (173): A pointer passed to DEALLOCATE points to an object that cannot be deallocated"
Now, if you toggle lines 39 and 40, the code runs as expected.
However, ror the case that fails, shouldn't the compiler detect the (incorrect?) use of TYPE instead of CLASS on line 39 though?
MODULE M1 IMPLICIT NONE TYPE,ABSTRACT :: T CHARACTER(LEN=:),ALLOCATABLE :: S CONTAINS PROCEDURE(P),DEFERRED,PASS(ARG) :: P END TYPE T PRIVATE :: P ABSTRACT INTERFACE SUBROUTINE P(ARG) IMPORT :: T IMPLICIT NONE CLASS(T) :: ARG END SUBROUTINE P END INTERFACE END MODULE M1 MODULE M2 USE M1 IMPLICIT NONE TYPE,EXTENDS(T) :: TT CONTAINS PROCEDURE,PASS(ARG) :: P END TYPE TT PRIVATE :: P INTERFACE MODULE SUBROUTINE P(ARG) IMPLICIT NONE CLASS(TT) :: ARG END SUBROUTINE P END INTERFACE END MODULE M2 SUBMODULE (M2) SM IMPLICIT NONE CONTAINS MODULE SUBROUTINE P(ARG) IMPLICIT NONE TYPE(TT) :: ARG ! This will trigger an error at run time. !CLASS(TT) :: ARG ! This works. ARG%S = 'oOOoops!' END SUBROUTINE P END SUBMODULE SM PROGRAM MAIN USE M2 IMPLICIT NONE TYPE(TT) :: W CALL W%P WRITE(*,*) W%S END PROGRAM MAIN
Link Copied
1 Reply
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks for reporting the issue. I have reproduced the error and open a bug report for it. The track ID is DPD200414511.
Thanks,
Xiaoping Duan
Intel Customer Support
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page