- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I was doing some tests on integer kind type parameters and something went wrong like: when I assign the value Z'80000000' to INTEGER(KIND=4) variable, the compiler generates a warning message saying that "The INTEGER(KIND=4) value is out-of-range"; But there's nothing odd when I assign Z'80' to INTEGER(KIND=1) variable as well as assign Z'8000' to INTEGER(KIND=2). So is it a compiler bug or something? By the way, Intel Parallel Studio 2015 is my current compiler.
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
In an assignment statement v = e, the kind of the variable v need not be the same as the kind of the expression e. Try this very short program:
write(*,*)kind(Z'80'),kind(Z'8000'),kind(Z'80000000') end
If you want to change the kind of the expression e to something other than the default kind for the type, the language gives you the means to do so.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank you, mecej4. I've tried your program and it all returned value 4. Does that mean the kind type of parameters like Z'xxxxxxxx' are acquiescently INTEGER(KIND=4)?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
It is not standard Fortran to use the Z'nnnn' syntax in this context. See Binary, Octal, Hexadecimal, and Hollerith Constants and especially the subsection Determining the Data Type of Nondecimal Constants. (Note - the documentation link will probably become broken in a future release - see the FAQ for the current starting link for documentation.)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank you so much, Steve. I've read the pages you mentioned and I got a clear view on this issue now.
![](/skins/images/872293744008A34B36F8ABF94A46CC66/responsive_peak/images/icon_anonymous_message.png)
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page