Silverfrost Forums

Welcome to our forums

IBSET giving error

15 Jun 2006 8:41 #738

If Debug/Checking is off and I try to comile the code below, I get the error: 'error 137 - Operand incompatible with opcode'

If I use Integer*4 only, the error goes away.

Interestingly, if the line

! iDataL = i1DataL

is uncommented, the error goes away too - lol

Does IBSET only work for Integer*4?

Could someone help me with this - thanx.

!======================================================================= ! PROGRAM Function BSET_MARE

!! Passed Integer2 i2BeforeP, i2AfterP Integer4 i4ArrayPosP

!! Locals Integer1 i1DataL Integer4 iDataL

  Integer*1, ALLOCATABLE :: i1BitArrayG(:)

! !======================================================================= ! i2BeforeP = 0 i2AfterP = 1 i4ArrayPosP = 12

  i1DataL = i1BitArrayG(i4ArrayPosP)

! iDataL = i1DataL

  If(i2BeforeP.EQ.1) Then
    iDataL = IBSET(iDataL, 0)
    i1DataL = IBSET(i1DataL, 0)
  Endif
  If(i2AfterP.EQ.1) Then
    iDataL = IBSET(iDataL, 1)
  Endif
  i1DataL = iDataL

  i1BitArrayG(i4ArrayPosP) = i1DataL

  End

! !=======================================================================

16 Jun 2006 1:42 #741

Brian

You must have modified code before posting it here. The posted code contains syntax errors as well as variables not allocated and not initialised. I have done a simple test on IBIT using an INTEGER*1 and my test worked OK.

The error message you quoted indicates a compiler bug or at least a programming error with a poor diagnostic but you will need to post the actual code that gave the error.

16 Jun 2006 7:33 #742

Yes there is a compiler bug here.

The code optimiser is failing on the statement

a = IBSET(a,0)

The following is sufficient to inhibit the optimiser in this context

a = IBSET(a+0,0)

but there will be lots of ways of avoiding the problem.

Please login to reply.