- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi all,
Encountered a little puzzle. Using default project settings for a console application, the following code creates a format specification statement with an internal write and then uses that format specifier in another write statement:
program WidthSpecifierError
character(LEN=200) :: cLine
integer(KIND=4) :: iLen, iArray(11)
iLen = 11
iArray(1:11) = (/1,2,3,4,5,6,7,8,9,10,11/)
write(*,*) 'Writing integer larger than width specifier'
write(cLine,'("(",I1,"(I2,1X))")') iLen
write(*,*) cline
write(*,cline) (iArray(i), i=1,iLen)
write(*,*)
write(*,*) 'Writing integer equal to width specifier'
write(cLine,'("(",I2,"(I2,1X))")') iLen
write(*,*) cline
write(*,cline) (iArray(i), i=1,iLen)
end program WidthSpecifierError
The output is thus under default Debug and Release compilation:
Writing integer larger than width specifier (*(I2,1X)) 1 2 3 4 5 6 7 8 9 10 11 Writing integer equal to width specifier (11(I2,1X)) 1 2 3 4 5 6 7 8 9 10 11 Press any key to continue . . .
The output is correct and consistent in both cases, but the format specifier "appears" to be mangled. Code similar to this compiled with PGI generated a runtime error. Is there a compiler flag for Intel that would catch this at runtime?
Ted
Intel(R) Visual Fortran Intel(R) 64 Compiler XE for applications running on Intel(R) 64, Version 12.0.5.221 Build 20110719
Copyright (C) 1985-2011 Intel Corporation. All rights reserved.
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Oh gosh - never mind - didn't look under Runtime flags - Check Edit Descriptor Data Size
Sorry to bother.
Ted
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page