View previous topic :: View next topic |
Author |
Message |
MarzAttax
Joined: 15 Jun 2006 Posts: 46
|
Posted: Thu Jun 15, 2006 9:41 am Post subject: IBSET giving error |
|
|
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
Integer*2 i2BeforeP, i2AfterP
Integer*4 i4ArrayPosP
!! Locals
Integer*1 i1DataL
Integer*4 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
!
!=======================================================================
|
|
Back to top |
|
|
brucebowler Guest
|
Posted: Thu Jun 15, 2006 12:38 pm Post subject: IBSET giving error |
|
|
Assuming that's a complete program, you don't allocate any space for i1BitArrayG. Since it's not allocated, it's not (to me) too surprising that things don't work quite as you expect. I *am* a bit surprised about the text of the error, I would have expected a different description of what went wrong... |
|
Back to top |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 8003 Location: Salford, UK
|
Posted: Fri Jun 16, 2006 2:42 am Post subject: IBSET giving error |
|
|
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. |
|
Back to top |
|
|
Anonymous Guest
|
Posted: Fri Jun 16, 2006 5:38 am Post subject: IBSET giving error |
|
|
I do not care about whether the variables are ALLOCATED and/or initialised
I am pointing out that I cannot "COMPILE" it, I do not CARE if it runs or not as the code is "MADE UP"
And NO I did not modify the code before I posted it.
Are you assuming that the code actually does something useful and runs.
Again, I am trying to show that the code does NOT compile under certain circumstances.
Could you tell me what the syntax errors are then, coz all I get is the compiler error I gave.
Bri |
|
Back to top |
|
|
brucebowler Guest
|
Posted: Fri Jun 16, 2006 6:54 am Post subject: IBSET giving error |
|
|
Syntax error #1 "Program function bset_mare" should be "program bset_mare".
Here's a much simpler (5 lines) program that also demonstrates the problem.
integer*1 a
integer*1 b
a = b
a = IBSET(a, 0)
end
Note that if you change the line a=b to a=1, the program does compile |
|
Back to top |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 8003 Location: Salford, UK
|
Posted: Fri Jun 16, 2006 8:33 am Post subject: IBSET giving error |
|
|
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.
|
|
Back to top |
|
|
Anonymous Guest
|
Posted: Fri Jun 16, 2006 9:34 am Post subject: IBSET giving error |
|
|
Ok, I admit that was wrong.
However there is no Syntax error from my compiler v4.8
Yes I know a newer one is available )
Thanx for the demo
|
|
Back to top |
|
|
|