- 新着としてマーク
- ブックマーク
- 購読
- ミュート
- RSS フィードを購読する
- ハイライト
- 印刷
- 不適切なコンテンツを報告
ifort does not compile the attached code, which I think is legal
program p implicit none character(len=*), parameter :: text = "message text" associate( msg => text ) write(*,*) msg end associate end program p
The error is
ifort test.f90 -o test test.f90(6): error #6404: This name does not have a type, and must have an explicit type. [MSG] write(*,*) msg ------------^ compilation aborted for test.f90 (code 1)
and happens for both versions:
Intel(R) Fortran Intel(R) 64 Compiler for applications running on Intel(R) 64, Version 17.0.0.098 Build 20160721
Intel(R) Fortran Intel(R) 64 Compiler for applications running on Intel(R) 64, Version 16.0.2.181 Build 20160204
Marco
コピーされたリンク
- 新着としてマーク
- ブックマーク
- 購読
- ミュート
- RSS フィードを購読する
- ハイライト
- 印刷
- 不適切なコンテンツを報告
Thanks for the nice test case - escalated as issue DPD200414550. I note that if IMPLICIT NONE is not used, then MSG is implicitly typed and is some uninitialized value. It works ok for integer parameters and character variables.
- 新着としてマーク
- ブックマーク
- 購読
- ミュート
- RSS フィードを購読する
- ハイライト
- 印刷
- 不適切なコンテンツを報告
Curiously, if IMPLICIT NONE is removed, the program runs and prints
109
which is the ASCII code for the first character of the message string!
I had thought that the associate name should be inheriting its type and other properties from the selector, and not be governed by implicit typing rules at all.
- 新着としてマーク
- ブックマーク
- 購読
- ミュート
- RSS フィードを購読する
- ハイライト
- 印刷
- 不適切なコンテンツを報告
Yes, I saw the same thing. Clearly in the CHARACTER, PARAMETER case the type isn't coming along for the ride.
