- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello again
I have just upgraded my compiler to w_fcompxe_2011.2.175 and its is giving me a bit of grief
In particular I'm having issues with implicit conversions between variable kinds
Here is an example - note that default integer is *2
INTEGER NLINK
INTEGER*4 IREC
NLINK = 20213
IREC = NLINK * 2
Gives IREC = -25110 . Although mathematically incorrect, I can understand why this is happening
But the previous version of the compiler I was using ( w_cprof_p_11.1.048 ) would result in IREC = 40426
Unfortunately we dont have the resources to track down and fix this issue right through our codebase (ancient and huge)
So is there a switch that forces fcompxe_2011.2.175 to behave as the older compiler?, or am I better to jusrt revert to the previous version?
Thankx
Jim
I have just upgraded my compiler to w_fcompxe_2011.2.175 and its is giving me a bit of grief
In particular I'm having issues with implicit conversions between variable kinds
Here is an example - note that default integer is *2
INTEGER NLINK
INTEGER*4 IREC
NLINK = 20213
IREC = NLINK * 2
Gives IREC = -25110 . Although mathematically incorrect, I can understand why this is happening
But the previous version of the compiler I was using ( w_cprof_p_11.1.048 ) would result in IREC = 40426
Unfortunately we dont have the resources to track down and fix this issue right through our codebase (ancient and huge)
So is there a switch that forces fcompxe_2011.2.175 to behave as the older compiler?, or am I better to jusrt revert to the previous version?
Thankx
Jim
Link Copied
2 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Actually, the new result is correct. Looks like we fixed a bug. The expression NLINK * 2 is evaluated in INTEGER*2 and overflows. The hex representation of the result is 9DEA, which is -25110. This is then converted to INTEGER*4 for the assignment to IREC and you get -25110.
I tried the earliest 11.1 compiler I have handy, which is 11.1.067, and it also gave -25110. A result of 40426 would mean that the compiler incorrectly evaluated the expression.
There is no switch that reverses this, other than not using /integer_size:16.
I tried the earliest 11.1 compiler I have handy, which is 11.1.067, and it also gave -25110. A result of 40426 would mean that the compiler incorrectly evaluated the expression.
There is no switch that reverses this, other than not using /integer_size:16.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The behavior that you ask for would violate the Fortran standard. If the 11.1.048 compiler did what you said it did, that was a bug, and you are asking for an option to reproduce the bug. I tried your example with the 8.1 compiler, with /integer_size:16, and the result was IREC = -25110.
I am curious to know what the resulting IREC would be if, instead of 20213, you used 32768.
I am curious to know what the resulting IREC would be if, instead of 20213, you used 32768.

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