SQRT instruction hangs freeAXP
- rspalding
- Topic Author
- Visitor
4 years 5 months ago #5727
by rspalding
SQRT instruction hangs freeAXP was created by rspalding
I happened to run an ancient FORTRAN program (a brute-force prime number generator written long ago, by Eric Postpischl - whose name appears in the VMS source listings).
On an real DS10 it runs correctly when compiled with /ARCH=HOST.
The same code causes freeAXP to hang.
This on v3.x as well as the current v4.0.0.649
If I omit the /ARCH=HOST option from the compile, the resulting code calls MATH$SQRT_F and the program runs to normal completion.
I repeated the test on both v3 and v4 freeAXP, running both HP v8.4 as well as VSI V8.4-2L1 and V8.4-2L2. All fail, apparently identically.
The freeAXP crash dump shows the SQRTF instruction as the last instruction executed.
Methinks there's a bug involving FSQRT. Of course, the problem might also be in the compiler's handling of /ARCH=HOST, where it is led erroneously to assume that FSQRT is supported by the freeAXP 'hardware'.
On an real DS10 it runs correctly when compiled with /ARCH=HOST.
The same code causes freeAXP to hang.
This on v3.x as well as the current v4.0.0.649
If I omit the /ARCH=HOST option from the compile, the resulting code calls MATH$SQRT_F and the program runs to normal completion.
I repeated the test on both v3 and v4 freeAXP, running both HP v8.4 as well as VSI V8.4-2L1 and V8.4-2L2. All fail, apparently identically.
The freeAXP crash dump shows the SQRTF instruction as the last instruction executed.
Methinks there's a bug involving FSQRT. Of course, the problem might also be in the compiler's handling of /ARCH=HOST, where it is led erroneously to assume that FSQRT is supported by the freeAXP 'hardware'.
Please Log in or Create an account to join the conversation.
- Bruce Claremont
- Topic Author
- Visitor
4 years 5 months ago #5728
by Bruce Claremont
Replied by Bruce Claremont on topic RE: SQRT instruction hangs freeAXP
We'll have a look. Can you provide the program source code?
Please Log in or Create an account to join the conversation.
- rspalding
- Topic Author
- Visitor
4 years 5 months ago #5729
by rspalding
Replied by rspalding on topic RE: SQRT instruction hangs freeAXP
Apologies to Mr. Postpischl, for my edits.
Code:
INTEGER PRIME
READ (5,*) N
C3 FORMAT (I10)
PRIME=1
DO 1 I=1, N
7 IF (PRIME .GE. 2 147 483 647) GO TO 999
PRIME= PRIME+ 1
J = IFIX( SQRT( FLOAT (PRIME))+ 0.999 )
J = MIN( J, PRIME-1)
IF (J .LT. 2) GOTO 7
DO 6 K= 2, J
IF ((PRIME - (( PRIME/ K )* K)) .EQ. 0) GO TO 7
6 CONTINUE
WRITE (6, *) PRIME
1 CONTINUE
C14 FORMAT (1X, I10)
999 STOP
END
Code:
INTEGER PRIME
READ (5,*) N
C3 FORMAT (I10)
PRIME=1
DO 1 I=1, N
7 IF (PRIME .GE. 2 147 483 647) GO TO 999
PRIME= PRIME+ 1
J = IFIX( SQRT( FLOAT (PRIME))+ 0.999 )
J = MIN( J, PRIME-1)
IF (J .LT. 2) GOTO 7
DO 6 K= 2, J
IF ((PRIME - (( PRIME/ K )* K)) .EQ. 0) GO TO 7
6 CONTINUE
WRITE (6, *) PRIME
1 CONTINUE
C14 FORMAT (1X, I10)
999 STOP
END
Please Log in or Create an account to join the conversation.
- rspalding
- Topic Author
- Visitor
4 years 5 months ago #5730
by rspalding
Replied by rspalding on topic RE: SQRT instruction hangs freeAXP
Sadly, somehow all the leading whitespace was deleted during posting.
Please apply the usual card-oriented rules for FORTRAN-66:
1-5 line number, 6 continuation flag, 7+ code, IIRC.
Perhaps the current compilers no longer care.
Please apply the usual card-oriented rules for FORTRAN-66:
1-5 line number, 6 continuation flag, 7+ code, IIRC.
Perhaps the current compilers no longer care.
Please Log in or Create an account to join the conversation.
- rspalding
- Topic Author
- Visitor
4 years 5 months ago #5731
by rspalding
Replied by rspalding on topic RE: SQRT instruction hangs freeAXP
I just tried to create a simpler reproducer - and thought I had failed.
The following code runs several iterations without a hang - but prints the wrong result (SQRT(2.0) != 2.75)
HOWEVER, on the 4th or 5th repetition of the loop, I do get the freeAXP hang.
This code runs correctly on a real iron (DS10).
1 READ (5,*) X
WRITE (6,*) SQRT(X)
GOTO 1
END
The following code runs several iterations without a hang - but prints the wrong result (SQRT(2.0) != 2.75)
HOWEVER, on the 4th or 5th repetition of the loop, I do get the freeAXP hang.
This code runs correctly on a real iron (DS10).
1 READ (5,*) X
WRITE (6,*) SQRT(X)
GOTO 1
END
Please Log in or Create an account to join the conversation.
- Bruce Claremont
- Topic Author
- Visitor
4 years 5 months ago #5732
by Bruce Claremont
Replied by Bruce Claremont on topic RE: SQRT instruction hangs freeAXP
Thanks for the source code. We've reproduced all of your results. Head scratched has ensued. I'll keep you posted.<hr>
Please Log in or Create an account to join the conversation.
Moderators: iamcamiel
Time to create page: 0.193 seconds