- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
the following code is compiled with noprotect_constants-option (and without /warn:interfaces) but the debug version generates a runtime exception in the second(!) call to foo. The reason is, that the compiler does not generate a temporary variable for -1.0
subroutine foo(a)
real*8 a
a=42
end
program Console
implicit none
call foo(1.0D0)
call foo(-1.0D0) ! <---- error
end program Console
My compiler-version is (integrated with VS2008)
Intel(R) Visual Fortran Package ID: w_fcompxe_2011.1.127
Intel(R) Visual Fortran Composer XE 2011 Integration for Microsoft Visual Studio* 2008, 12.0.3470.2008, Copyright (C) 2002-2010 Intel Corporation
* Other names and brands may be claimed as the property of others.
PS:
Further inspections showed, that the compiler fails to generate the temporary variable if the argument is a compile-time evaluated expression (and negative floats seem to be handled as the expression "minus(absolute value)"). For expression of integers there is the same wrong behaviour except that negative constants are handled correctly.
IMO this is a serious bug that should be fixed immediately, as programmers rely on the noprotect_constants-option to produce safe code.
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I recall a circumstance in ~1968 where a user created constant, expressly for obfuscation, whereby the constant(s) were modified in a hidden way. Then these literals were used in an open source (not Open Source) routine. However, now the literals were not now what was expressed in the source. IOW the individual could disclose the algorithm without the required constants .AND. while providing undisclosed errors in the provided code causing countless hours of debugging by others.-- Jim Dempsey. That's an interesting example. I have the impression that vendor extensions to the Fortran standard are not rare, but there are only scant resources for ascertaining the problem(s) that those extensions address.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page