Fortran on X86 : **2 on a complex*16 crashes

Post Reply

Topic author
joukj
Master
Posts: 175
Joined: Thu Aug 27, 2020 5:50 am
Reputation: 0
Status: Offline

Fortran on X86 : **2 on a complex*16 crashes

Post by joukj » Tue Jun 13, 2023 7:42 am

Hi all

I found this, which is not to be expected:

Code: Select all

rumba-jj) f90/vers
VSI Fortran X8.5-0002 (GEM 50X2N) for X86 systems
rumba-jj) ty test.f90 
program test
  complex*16 x
  x =x**2
end
  13-JUN-2023 13:33:32
rumba-jj) f90 test
rumba-jj) link test
rumba-jj) run test
%SYSTEM-F-ACCVIO, access violation, reason mask=06, virtual address=000000000000
0002, PC=FFFF830008A491FB, PS=0000001B
%TRACE-F-TRACEBACK, symbolic stack dump follows
image     module    routine               line      rel PC           abs PC     
LIBOTS                                       0 00000000800021FB FFFF830008A491FB
DPML$SHR  DPML_CPOWI.C;1                #13088 0000000080072E93 FFFF830008C51E93
TEST  test.f90;33  TEST                      3 0000000000000045 0000000080000045
                                             0 FFFF8300071FBDC6 FFFF8300071FBDC6
DCL                                          0 000000008006741B 000000007ADFF41B
%TRACE-I-LINENUMBER, Leading '#' specifies a source file record number.
%TRACE-I-END, end of TRACE stack dump
rumba-jj)
Last edited by marty.stu on Tue Jun 13, 2023 7:45 am, edited 1 time in total.

User avatar

arne_v
Master
Posts: 347
Joined: Fri Apr 17, 2020 7:31 pm
Reputation: 0
Location: Rhode Island, USA
Status: Online
Contact:

Re: Fortran on X86 : **2 on a complex*16 crashes

Post by arne_v » Tue Jun 13, 2023 7:58 am

That must be a bug. John Reagan!!!! :-)

But I am curious whether it also crashes if you do:

x = 1
x = x **2

(I have no gotten my own VMS x86-64 up and running yet)
Arne
arne@vajhoej.dk
VMS user since 1986


Topic author
joukj
Master
Posts: 175
Joined: Thu Aug 27, 2020 5:50 am
Reputation: 0
Status: Offline

Re: Fortran on X86 : **2 on a complex*16 crashes

Post by joukj » Tue Jun 13, 2023 10:30 am

Yes it does. Sorry I stripped the sample code too much to get the smallest reproducer.

User avatar

arne_v
Master
Posts: 347
Joined: Fri Apr 17, 2020 7:31 pm
Reputation: 0
Location: Rhode Island, USA
Status: Online
Contact:

Re: Fortran on X86 : **2 on a complex*16 crashes

Post by arne_v » Tue Jun 13, 2023 2:59 pm

OK.

Given your other post then it looks like the math lib on x86-64 has a few "issues".
Arne
arne@vajhoej.dk
VMS user since 1986


jreagan
VSI Expert
Master
Posts: 139
Joined: Tue Dec 01, 2020 8:40 am
Reputation: 0
Status: Offline

Re: Fortran on X86 : **2 on a complex*16 crashes

Post by jreagan » Wed Jun 14, 2023 10:26 am

"long double" (aka REAL*16, COMPLEX*16, Pascal QUADRUPLE, etc) is currently a work in progress (the release notes should say that).

The cross-compilers used to build the underlying Math routines know only about x86 f80 (10bytes of data in a 10byte container). However, OpenVMS wants IEEE X floating (16bytes of data in a 16byte container). The newer LLVM we use for native compilers knows about all three forms:

- 10bytes of F80 in a 10byte container
- 10bytes of F80 in a 16byte container
- 16bytes of IEEE_X in a 16byte container

It will have to all wait for native builds of the Math RTL (and possibly other RTLs) to get all of the long double working)


Topic author
joukj
Master
Posts: 175
Joined: Thu Aug 27, 2020 5:50 am
Reputation: 0
Status: Offline

Re: Fortran on X86 : **2 on a complex*16 crashes

Post by joukj » Thu Jun 15, 2023 2:29 am

I thought complex*16 is just "double precision: (real*8,real*8)


jreagan
VSI Expert
Master
Posts: 139
Joined: Tue Dec 01, 2020 8:40 am
Reputation: 0
Status: Offline

Re: Fortran on X86 : **2 on a complex*16 crashes

Post by jreagan » Thu Jun 15, 2023 9:48 pm

Yes, my bad. I had confused the KIND= syntax.

Yes, COMPLEX*8 is a pair of REAL*4; COMPLEX*16 is a pair of REAL*8, and COMPLEX*32 is a pair of REAL*16.

COMPLEX(KIND=4) is COMPLEX*8
COMPLEX(KIND=8) is COMPLEX*16
COMPLEX(KIND=16) is COMPLEX*32

DOUBLE COMPLEX is COMPLEX(8) is COMPLEX*16

Confusing

Post Reply