I discovered that a colleague had used a non-standard logical expression in a program, but that it had compiled and run without complaint (whether it ran correctly is another matter).
The logical expression was of the form: i > j > k
So I wrote the code fragment below and it compiled and ran successfully (CVF 6.6B) with the annotated results:
integer*4 i, j, k logical*1 Result ! Result i = 2; j = 3; k = 4 ! Expected Actual Result = i < j < k ! .TRUE. .TRUE. Result = i > j > k ! .FALSE. .FALSE. i = 2; j = 3; k = 2 Result = i < j < k ! .FALSE. .TRUE. Result = i > j > k ! .FALSE. .FALSE. i = 4; j = 3; k = 4 Result = i < j < k ! .FALSE. .TRUE. Result = i > j > k ! .FALSE. .FALSE.
I can see that it is well worth avoiding such expressions, but I am concerned that the compiler does not pick them up as illegal. Could somebody please explain this?
HTML tags (with square brackets) do not seem to work for me today, so apologies if the code is not so easy to read.