- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The following code
PROGRAM test_stuff
USE, INTRINSIC :: ISO_FORTRAN_ENV
IMPLICIT NONE
INTEGER(KIND=INT8) :: ivar1
REAL(KIND=REAL128) :: rvar1
PRINT *,"real128: ", real128
ivar1 = 9
rvar1 = cnv_real128(ivar1)
CONTAINS
FUNCTION cnv_real128(icls) RESULT(out)
CLASS(*), INTENT(IN) :: icls
REAL(KIND=REAL128), ALLOCATABLE :: out
ALLOCATE(out)
SELECT TYPE(icls)
TYPE IS (INTEGER(KIND=INT8))
out = REAL(icls, KIND=REAL128)
CLASS DEFAULT
out = REAL(0.0,KIND=REAL128)
END SELECT
END FUNCTION cnv_real128
END PROGRAM test_stuff
gives me a segmentation fault at runtime. Replacing REAL128 with REAL64 gives me no error. I've tried with ifort-16.0 and 17.0. Is this somehow expected?
Thanks in advance!
Link Copied
2 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Try attributing out with 16 byte alignment.
!DIR$ ATTRIBUTES ALIGN: 16 :: out
Jim Dempsey
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The problem is caused by the function result being ALLOCATABLE and REAL128 - something is going very wrong there and I'll create a bug report for it. If OUT is not ALLOCATABLE, it works fine. Issue ID is DPD200415360.
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