- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
consider the following code:
program p implicit none logical, parameter :: use_v1 = .true. integer, parameter :: v1 = 3, v2 = 8 integer, parameter :: & ! this produces a warning at compile time and wrong result i = v1*count( (/use_v1/) ) + v2*count( (/.not.use_v1/) ) ! this produces an ICE at compile time !i = v1*count( (/use_v1/) ,kind=kind(i)) + v2*count( (/.not.use_v1/) ) write(*,*) i end program p
Compiling with
ifort -stand f08 p.f90 -o p
I see two warnings and wrong results at run time (-3 instead of 3)
$ ifort -stand f08 p.f90 -o p
p.f90(9): warning #6192: Fortran 2008 does not allow this data type conversion.
i = v1*count( (/use_v1/) ) + v2*count( (/.not.use_v1/) )
----------^
p.f90(9): warning #6192: Fortran 2008 does not allow this data type conversion.
i = v1*count( (/use_v1/) ) + v2*count( (/.not.use_v1/) )
-----------------------------------^
$ ./p
-3
Isn't the code right? In any case, I don't understand which type conversion is intended here.
Using the commented line, where the kind is specified, I see an internal compiler error.
$ ifort -V
Intel(R) Fortran Intel(R) 64 Compiler XE for applications running on Intel(R) 64, Version 15.0 Build 20150121
Thanks, Marco
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The "wrong result' is a bug we recently fixed. I'll make sure the standards warning and internal compiler error get addressed as well. Thanks. Issue ID is DPD200366418 (the "wrong result" issue is DPD200366183.)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
OK, thank you. Marco
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
These problems have been fixed in our sources - I expect the fix to be included in 15.0 Update 3.

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page