- 신규로 표시
- 북마크
- 구독
- 소거
- RSS 피드 구독
- 강조
- 인쇄
- 부적절한 컨텐트 신고
I have a suspicion that this might be fixed in a more recent version of ifort, but I am seeing catastrophic errors for the following code.
[fortran]MODULE mymod
IMPLICIT NONE
CONTAINS
FUNCTION mv_char(in) RESULT(out)
CHARACTER(:), POINTER, INTENT(in) :: in
CHARACTER(:), POINTER :: out
ALLOCATE(CHARACTER(LEN(TRIM(ADJUSTL(in)))) :: out)
out = TRIM(ADJUSTL(in))
END FUNCTION mv_char
END MODULE mymod
PROGRAM caterr
USE mymod
IMPLICIT NONE
CHARACTER(:), POINTER :: mystr=>NULL(), foo=>NULL()
ALLOCATE(CHARACTER(3) :: foo)
foo = 'foo'
mystr => mv_char(foo)
END PROGRAM caterr[/fortran] When compiled:
[bash]$ ifort cat_err.f90
cat_err.f90(20): catastrophic error: **Internal compiler error: internal abort** Please report this error along with the circumstances in which it occurred in a Software Problem Report. Note: File and line given may not be explicit cause of this error.
mystr => mv_char(foo)
-----------^
compilation aborted for cat_err.f90 (code 3)[/bash] If line 5 is changed from [fortran] CHARACTER(:), POINTER, INTENT(in) :: in[/fortran] to[fortran] CHARACTER(*), POINTER, INTENT(in) :: in[/fortran] I get the following compilation error which i can't understand:
[bash]$ ifort cat_err.f90
cat_err.f90(20): error #8298: If a dummy argument is allocatable or a pointer, the associated actual argument shall have deferred length parameter if and only if the dummy argument has deferred length parameter. [FOO]
mystr => mv_char(foo)
-------------------^
compilation aborted for cat_err.f90 (code 1)[/bash] Is this a bug that has been seen before and is now fixed in the latest release?
In the second form of the code, is the compiler correct in issuing that error?
Thanks,
-Z
링크가 복사됨
- 신규로 표시
- 북마크
- 구독
- 소거
- RSS 피드 구독
- 강조
- 인쇄
- 부적절한 컨텐트 신고
[bash]$ ifort -V Intel Fortran Intel 64 Compiler Professional for applications running on Intel 64, Version 11.1 Build 20090630 Package ID: l_cprof_p_11.1.046 Copyright (C) 1985-2009 Intel Corporation. All rights reserved.[/bash]
- 신규로 표시
- 북마크
- 구독
- 소거
- RSS 피드 구독
- 강조
- 인쇄
- 부적절한 컨텐트 신고
error #8307: If a dummy argument is allocatable or a pointer, the associated actual argument shall have deferred length parameter if and only if the dummy argument has deferred length parameter. [FOO]
mystr => mv_char(foo)
-------------------------^
compilation aborted
Still perhaps not as explicit as something like "Fortran 77 (*) notation (f90 assumed size) not compatible with POINTER
- 신규로 표시
- 북마크
- 구독
- 소거
- RSS 피드 구독
- 강조
- 인쇄
- 부적절한 컨텐트 신고
- 신규로 표시
- 북마크
- 구독
- 소거
- RSS 피드 구독
- 강조
- 인쇄
- 부적절한 컨텐트 신고
- 신규로 표시
- 북마크
- 구독
- 소거
- RSS 피드 구독
- 강조
- 인쇄
- 부적절한 컨텐트 신고
- 신규로 표시
- 북마크
- 구독
- 소거
- RSS 피드 구독
- 강조
- 인쇄
- 부적절한 컨텐트 신고
I have rewritten your program to use the feature correctly (and added a PRINT of the result). Note that no explicit ALLOCATE is required. (Your original program compiles successfully in version 12.1.)
[fortran] MODULE mymod IMPLICIT NONE CONTAINS FUNCTION mv_char(in) RESULT(out) CHARACTER(*), INTENT(in) :: in CHARACTER(:), ALLOCATABLE :: out out = TRIM(ADJUSTL(in)) END FUNCTION mv_char END MODULE mymod PROGRAM caterr USE mymod IMPLICIT NONE CHARACTER(:), ALLOCATABLE:: mystr, foo foo = 'foo' mystr = mv_char(foo) print *, mystr END PROGRAM caterr [/fortran]
- 신규로 표시
- 북마크
- 구독
- 소거
- RSS 피드 구독
- 강조
- 인쇄
- 부적절한 컨텐트 신고
- 신규로 표시
- 북마크
- 구독
- 소거
- RSS 피드 구독
- 강조
- 인쇄
- 부적절한 컨텐트 신고
Hi, please help with problem when used the both of pointer Character and assumed-length Character as arguments. The pointer character alone works fine, but the assumed-length character cannot pass correctly. So the result string mystr =='foo1' , while it is supposed to be 'foo1foo2'
Thanks.
- 신규로 표시
- 북마크
- 구독
- 소거
- RSS 피드 구독
- 강조
- 인쇄
- 부적절한 컨텐트 신고
Which version of the Intel compilers are you using, and how are you building the executable? (What flags etc. are you passing to ifort?) What architecture/OS are you on?
- 신규로 표시
- 북마크
- 구독
- 소거
- RSS 피드 구독
- 강조
- 인쇄
- 부적절한 컨텐트 신고
I can reproduce the problem. Something is not being passed correctly. I will let the developers know. Issue ID is DPD200249515.
- 신규로 표시
- 북마크
- 구독
- 소거
- RSS 피드 구독
- 강조
- 인쇄
- 부적절한 컨텐트 신고
Hi, please help with problem when used the both of pointer Character and assumed-length Character as arguments.
Either the pointer character or assumed-length character as argument alone works fine, but if there is pointer character before the assumed-length character in the argument list, assumed-length character is blocked and cannot pass correctly.
I tested the examples under "Compiling with Intel(R) Visual Fortran Compiler XE 13.1.3.198 [IA-32]"
Thanks.
- 신규로 표시
- 북마크
- 구독
- 소거
- RSS 피드 구독
- 강조
- 인쇄
- 부적절한 컨텐트 신고
Thank you very much, Steve! It is the 2nd time I tried to solve problem through this forum and I am really moved that so many warmhearted people are helping each other and IVF really needs this contribution.
Thanks to Zaak. It is your example that excited me to revert back to this issue.
Steve, specially thank you. You have solved countless problems for us and IVF.
Kong
- 신규로 표시
- 북마크
- 구독
- 소거
- RSS 피드 구독
- 강조
- 인쇄
- 부적절한 컨텐트 신고
Kong, the problem you reported is fixed for a release later this year.
