Operating System - OpenVMS
1748104 Members
4543 Online
108758 Solutions
New Discussion юеВ

Re: FORTRAN Compile Link Error

 
SOLVED
Go to solution
MJ26
Frequent Advisor

FORTRAN Compile Link Error

I am receiving the following error when I compile the following code:


prvmsk(1) = ( prv$m_bypass .or. prv$m_cmkrnl .or.
......................^
%F90-W-WARNING, Overflow occurred while evaluating constant expression.
at line number 60 in file DKA0:[CODE]DEFRAG.FOR;30


If I limit the amount of .or. statements, it compiles just fine. I also noticed that if I move the prv$m_share to the front, it fails as well. So I'm not sure if there is an order of precedence as to what is being checked, or if that IA64 compiler is acting funny with the entire statement. It does compile on an Alpha with no issues.


c
c define the system parameters
c
include '($prvdef)'
c
c define the functions referenced
c
integer sys$setprv, sys$bintim
integer lib$get_symbol, lib$set_symbol
integer str$position
c
c define the external references
c

c
c define the local parameters
c

c
c define the local variables
c
character*1024 cmd_str, vol_str, qual_str
character*255 p1_str, p2_str, p3_str, func_str
character*32 end_str
integer p1_len, p2_len, p3_len, func_len
integer cmd_len, vol_len, qual_len
integer iret, i, prvmsk(2), end_len
integer*4 end_time(2)
c
c get the proper privileges
c
prvmsk(1) = ( prv$m_bypass .or. prv$m_cmkrnl .or.
1 prv$m_detach .or. prv$m_netmbx .or. prv$m_sysgbl .or.
2 prv$m_world .or. prv$m_syslck .or. prv$m_sysprv .or.
3 prv$m_tmpmbx .or. prv$m_share )
iret = sys$setprv ( %val(1), prvmsk, , )
c
c get the parameters for this operation
c
iret = lib$get_symbol ( 'P1', p1_str, p1_len )
iret = lib$get_symbol ( 'P2', p2_str, p2_len )
iret = lib$get_symbol ( 'P3', p3_str, p3_len )
c
c special case check for HOST function
c
if ( p1_str(:p1_len) .eq. 'HOST' ) then
call update_host_list ( p2_str(:p2_len) )
goto 800
endif
c
c extract the function from the qualifiers
c
i = str$position ( p1_str(:p1_len), '/' )
if ( i .gt. 0 ) then
call str$trim ( func_str, p1_str(:i-1), func_len )
call str$trim ( qual_str, p1_str(i:p1_len), qual_len )
else
call str$trim ( func_str, p1_str(:p1_len), func_len )
call str$trim ( qual_str, ' ', qual_len )
endif
c
c extract the end time from the P3
c
call str$element ( end_str, 1, ',', p3_str(:p3_len) )
call str$trim ( end_str, end_str, end_len )
i = str$position ( end_str(:end_len), ':' )
end_str(i:i) = ' '
iret = sys$bintim ( end_str(:end_len), end_time )
if (.not. iret) call sys$gettim ( end_time )
c
c generate the command needed for this function
c ABORT is easy, need a subroutine for the FILE and FREE passes
c
if ( func_str(:func_len) .eq. 'ABORT' ) then
call sys$fao ( 'DEFRAGMENT ABORT !AS', cmd_len, cmd_str,
1 p2_str(:p2_len) )
call str$trim ( vol_str, ' ', vol_len )
call lib$set_symbol ( 'DEFRAG_VOL', vol_str(:vol_len) )
call lib$set_symbol ( 'DEFRAG_FIX', vol_str(:vol_len) )
else
call sys$fao ( 'DEFR VOLU !AS', cmd_len, cmd_str,
1 p2_str(:p2_len) )
call set_vol_symb ( func_str(:func_len), p2_str(:p2_len),
1 end_time )
if ( func_str(:func_len) .eq. 'FILE' ) then
call lib$set_symbol ( 'DEFRAG_FIX',
1 '/NOCONS/PROL=P_FILE/EPIL=P_FILE' )
else
call lib$set_symbol ( 'DEFRAG_FIX',
1 '/CONS/PROL=P_FREE/EPIL=P_FREE' )
endif
endif
c
c create the base command and required qualifier symbols
c
call lib$set_symbol ( 'DEFRAG_CMD', cmd_str(:cmd_len) )
call lib$set_symbol ( 'DEFRAG_QUAL', qual_str(:qual_len) )
c
c that's all
c
800 continue
end
14 REPLIES 14
Steven Schweda
Honored Contributor

Re: FORTRAN Compile Link Error

> If I limit the amount of .or. statements,
> [...]

What, exactly, does that mean? (And ".or."
is an operator, not a statement.)

> I also noticed that if I move the
> prv$m_share to the front, it fails as well.

Why would you do that?

What, exactly, seems to work, and what,
exactly, seems to fail?

I'd guess that a much shorter test case would
show the problem just as well.

If throwing out PRV$M_SHARE helps, then,
knowing nothing, I'd guess that it's a
sign-bit problem. PRV$M_SHARE = 0x80000000.)
I wouldn't expect a logical operator to
trigger an overflow complaint, however.
abrsvc
Respected Contributor

Re: FORTRAN Compile Link Error

For grins, take out the PRV_SHARE and see if that compiles OK. That one sets the "sign" bit and maybe causing a problem. The code should work. Please report the results.

Dan
MJ26
Frequent Advisor

Re: FORTRAN Compile Link Error

I removed the prv$m_share, and yes, it did compile successfully. Any thoughts as to why it would not like prv$m_share?
Steven Schweda
Honored Contributor

Re: FORTRAN Compile Link Error

> [...] Any thoughts as to why it would not
> like prv$m_share?

Are you reading these responses?
Hein van den Heuvel
Honored Contributor
Solution

Re: FORTRAN Compile Link Error

Fortran integers are signed.
The value for SHARE does NOT fit.
It is 1 higher than the max.

Much like DCL:

$ x=%x80000000
$ sho sym x
X = -2147483648 Hex = 80000000 Octal = 20000000000

So you could use "-2147483648" instead of _SHARE.

Or just simply use -1 and get ALL privs :-)

Oddly (imho) LOGICAL(KIND=4) has the same restriction.

You could just use a 64 bit mask in one go:

integer(kind=8) prvmsk
prvmsk = ( prv$m_bypass .or. ... prv$m_share )
iret = sys$setprv ( %val(1), prvmsk, , )


That works.
Or you can play with equivalences and HEX constants

Or use a language that can handle 'unsigned'

fwiw,
Hein




MJ26
Frequent Advisor

Re: FORTRAN Compile Link Error

Hein - Thanks! That worked:

integer(kind=8) prvmsk
c
c get the proper privileges
c
prvmsk = ( prv$m_bypass .or. prv$m_cmkrnl .or.
1 prv$m_detach .or. prv$m_netmbx .or. prv$m_sysgbl .or.
2 prv$m_world .or. prv$m_syslck .or. prv$m_sysprv .or.
3 prv$m_tmpmbx .or. prv$m_share )
iret = sys$setprv ( %val(1), prvmsk, , )



Appreciate the assistance and explanation.
MJ26
Frequent Advisor

Re: FORTRAN Compile Link Error

Hein's suggestion worked successfully. Closing thread.
Hein van den Heuvel
Honored Contributor

Re: FORTRAN Compile Link Error

Actually, using HEX notation would not work. That's what the include file does:

PARAMETER PRV$M_SHARE = '80000000'X

I like using the BIT definitions instead of the MASKS

I would also not be above defining a fresh, negative, constant with all the right bits set and a name + comment to indicate that.
To construct the value I would once use DCL and libr/extr=$prvdef/out=tt: sys$library:FORSYSDEF.TLB

fwiw,
easy read on the limit on integers:
http://docs.hp.com/en/B3909-90002/ch08s01.html

Hein
Mike Kier
Valued Contributor

Re: FORTRAN Compile Link Error

Or you could use the bit number symbols with the intrinsic IBSET - I don't have an Integrity system to test on, so I don't know if it would throw the warning.

I also think the code is more readable and the intent is clearer that you're explicitly setting bits in a mask:

prvmsk = 0
prvmsk = IBSET(prvmsk, PRV$V_SHARE)
prvmsk = IBSET(prvmsk, PRV$V_BYPASS)
.
.
.
Practice Random Acts of VMS Marketing