- 新着としてマーク
- ブックマーク
- 購読
- ミュート
- RSS フィードを購読する
- ハイライト
- 印刷
- 不適切なコンテンツを報告
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!
コピーされたリンク
2 返答(返信)
- 新着としてマーク
- ブックマーク
- 購読
- ミュート
- RSS フィードを購読する
- ハイライト
- 印刷
- 不適切なコンテンツを報告
Try attributing out with 16 byte alignment.
!DIR$ ATTRIBUTES ALIGN: 16 :: out
Jim Dempsey
- 新着としてマーク
- ブックマーク
- 購読
- ミュート
- RSS フィードを購読する
- ハイライト
- 印刷
- 不適切なコンテンツを報告
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.
