|
| Watcom Fortran 77 vs. Compaq Fortran |
 |
Wed, 30 Jan 2008 16:58:45 GMT |
Hi all,
I am using Compaq Visual Fortran (on Windows) for my research. I compiled
the same program with Watcom (both for Windows and for OS/2) and with
Compaq.
One interesting difference appeared to me: when CVF interprets .LE. as
"less or equal than" (which is the correct interpretation according to
Fortran tutorials), Watcom interprets .LE. as "strictly less than"
(should
normally be .LT.). I was comparing integers when using the function.
Therefore, the same program compiled with the different compilers does not
have the same effects!!
Is there a reason why this happens ? Why does Watcom not follow Fortran 77
rules?
Again, this is the only real Fortran compiler we have, so it should be
totally compliant to the standards. Is there anything to do (other than
modifying the program each time you change compilers..)?
AyPP
PS: I still hope I can get some feedback on a GNU Fortran 95 g95 port...
|
| Post Reply
|
| Re: Watcom Fortran 77 vs. Compaq Fortran |
 |
Thu, 31 Jan 2008 06:30:04 +010 |
On Wed, 30 Jan 2008 16:58:45 GMT, Aymeric Peyret wrote:
:>Hi all,
:>
:>I am using Compaq Visual Fortran (on Windows) for my research. I compiled
:>the same program with Watcom (both for Windows and for OS/2) and with
:>Compaq.
:>
:>One interesting difference appeared to me: when CVF interprets .LE. as
:>"less or equal than" (which is the correct interpretation
according to
:>Fortran tutorials), Watcom interprets .LE. as "strictly less
than" (should
:>normally be .LT.). I was comparing integers when using the function.
:>Therefore, the same program compiled with the different compilers does not
:>have the same effects!!
:>
:>Is there a reason why this happens ? Why does Watcom not follow Fortran 77
:>rules?
:>
:>Again, this is the only real Fortran compiler we have, so it should be
:>totally compliant to the standards. Is there anything to do (other than
:>modifying the program each time you change compilers..)?
You better ask this question in the openwatcom.users.fortran group at
news.openwatcom.org .
Mat Nieuwenhoven
|
| Post Reply
|
| Re: Watcom Fortran 77 vs. Compaq Fortran |
 |
Thu, 31 Jan 2008 09:07:13 -060 |
Asymeric:
I use the Watcom fortran compiler daily under OS/2-eCS, almost from the
day it first appeared on the market many years ago. While in the early
days I did have my share of (little) problems with it, upgrading over
the years to the most recent version has solved all the (very minor)
problems that I have noticed. I have never - never ! - experienced such
a severe problem as you report. If you have a short sample program which
shows the problem, send it to me and I will run it here and see; I shall
also write my own little program to test what you report, as soon as I
find the time - this weekend, I hope. All the best!
Lothar
Aymeric Peyret wrote:
> Hi all,
>
> I am using Compaq Visual Fortran (on Windows) for my research. I
> compiled the same program with Watcom (both for Windows and for OS/2)
> and with Compaq.
>
> One interesting difference appeared to me: when CVF interprets .LE. as
> "less or equal than" (which is the correct interpretation
according to
> Fortran tutorials), Watcom interprets .LE. as "strictly less
than"
> (should normally be .LT.). I was comparing integers when using the
> function.
> Therefore, the same program compiled with the different compilers does
> not have the same effects!!
>
> Is there a reason why this happens ? Why does Watcom not follow Fortran
> 77 rules?
>
> Again, this is the only real Fortran compiler we have, so it should be
> totally compliant to the standards. Is there anything to do (other than
> modifying the program each time you change compilers..)?
>
> AyPP
>
> PS: I still hope I can get some feedback on a GNU Fortran 95 g95 port...
|
| Post Reply
|
| Re: Watcom Fortran 77 vs. Compaq Fortran |
 |
Thu, 31 Jan 2008 17:47:04 GMT |
Lothar Frommhold wrote:
> Asymeric:
> I use the Watcom fortran compiler daily under OS/2-eCS, almost from the
> day it first appeared on the market many years ago. While in the early
> days I did have my share of (little) problems with it, upgrading over
> the years to the most recent version has solved all the (very minor)
> problems that I have noticed. I have never - never ! - experienced such
> a severe problem as you report. If you have a short sample program which
> shows the problem, send it to me and I will run it here and see; I shall
> also write my own little program to test what you report, as soon as I
> find the time - this weekend, I hope. All the best!
> Lothar
> Aymeric Peyret wrote:
>> Hi all,
>>
>> I am using Compaq Visual Fortran (on Windows) for my research. I
>> compiled the same program with Watcom (both for Windows and for OS/2)
>> and with Compaq.
>>
>> One interesting difference appeared to me: when CVF interprets .LE. as
>> "less or equal than" (which is the correct interpretation
according to
>> Fortran tutorials), Watcom interprets .LE. as "strictly less
than"
>> (should normally be .LT.). I was comparing integers when using the
>> function.
>> Therefore, the same program compiled with the different compilers does
>> not have the same effects!!
>>
>> Is there a reason why this happens ? Why does Watcom not follow Fortran
>> 77 rules?
>>
>> Again, this is the only real Fortran compiler we have, so it should be
>> totally compliant to the standards. Is there anything to do (other than
>> modifying the program each time you change compilers..)?
>>
>> AyPP
>>
>> PS: I still hope I can get some feedback on a GNU Fortran 95 g95
port...
>>
Lothar: Please see my answer by email.
For all others, I can summarize it that way:
the .LE. function is fine with Watcom (same output as with Compaq).
However, the IARGC function, when used with Watcom, returns the total
number of words on the command line instead of the number of arguments.
That is, if you have an executable called "executable.exe" that you
use
with 3 arguments "arg1" "arg2" and "arg3", i.e.
you have on your command
line "executable arg1 arg2 arg3", Watcom will give 4 as the result of
the
IARGC function, whereas Compaq will give 3 (real number of arguments). I
did not know that, and that's why I made this wrong comment about .LE.
Therefore, if your executable is discriminating cases using the number of
arguments, (for instance: IF number_of_arguments.LE.some_value THEN
something), some_value will have to be different (one unit more) when
compiled using Watcom and when compiled using Compaq, *as if* .LE. was a
strict inequality with Watcom and the IARGC function had the same result
with both compilers.
Morals of the story:
1) trust basic functions such as .LE. but check the output of 'system
functions' such as IARGC
2) Inductive reasoning is prone to hasty generalization (especially if you
have the wrong hypothesis)...
AyPP
|
| Post Reply
|
|
|