:) good idea, no effect...
Forcing the operation order does not change anything?

If (i<13) & (i>0) then

If not, then only some workaround on the if, separe it in two sentences,
that usually works.


On Fri 18 Aug 2023, 6:12 PM '[email protected]' via jallib, <
[email protected]> wrote:

> I remove d "-no-variable-reuse" from the compiler call to see if there is
> a different:
> No it is not, but good idea!
>
> Best Regards,
> Andreas
>
> On Friday, August 18, 2023 at 1:45:42 PM UTC+2 vsurducan wrote:
>
>> Hi Rob, I think it's about disabling reusing variable space and not about
>> expression reduction.
>>
>> On Fri 18 Aug 2023, 9:48 AM Rob CJ, <[email protected]> wrote:
>>
>>> Hi Andreas
>>>
>>> Strange, I will do some testing this weekend.
>>>
>>> Thanks for the update.
>>>
>>> Met vriendelijke groet,
>>> Rob Jansen
>>> ------------------------------
>>> *From:* '[email protected]' via jallib <
>>> [email protected]>
>>> *Sent:* Friday, August 18, 2023 8:33:06 AM
>>> *To:* jallib <[email protected]>
>>> *Subject:* Re: [jallib] IF statement fails
>>>
>>> Hi Rob,
>>>
>>> I tried that. As a result the code size increased (+200 byte), but the
>>> program doesn't work any more, the output on my display stopped working, so
>>> it's hard to further debug this.
>>> So it's not clear if this helps or not because then other problems come
>>> into.
>>>
>>> Andreas
>>>
>>> On Thursday, August 17, 2023 at 10:29:51 PM UTC+2 Rob CJ wrote:
>>>
>>> Hi Andreas,
>>>
>>> It might be a optimization issues.
>>>
>>> Can you add the following to your program and test if the problem is
>>> gone?
>>>
>>>   pragma opt expr_reduce no
>>>
>>> It will disable code optimization.
>>>
>>> Thanks.
>>>
>>> Kind regards,
>>>
>>> Rob
>>>
>>> ------------------------------
>>> *Van:* '[email protected]' via jallib <[email protected]
>>> >
>>> *Verzonden:* donderdag 17 augustus 2023 21:42
>>>
>>> *Aan:* jallib <[email protected]>
>>> *Onderwerp:* Re: [jallib] IF statement fails
>>> Hi Rob,
>>> thanks that you are digging into this problem and maybe found the issue
>>> already.
>>> I'm a heavy Jal User I would call myself, but this is the first issue I
>>> found over the last years :-)
>>>
>>> On Thursday, August 17, 2023 at 9:31:13 PM UTC+2 Rob CJ wrote:
>>>
>>> Hi Andreas,
>>>
>>> I had a quick look at the generated assemble code for a PIC16.
>>>
>>> In your first code example the code is (I changed 3 times i into i, j
>>> and k so I could compile it):
>>>
>>>  ;   10 i=test1()
>>>                                movlw    0
>>>                                movwf    v_i
>>> ;   11 if i>0 & i<13 then
>>>                                movf     v_i,w
>>>                                bsf      v__bitbucket, 0 ; _btemp1
>>>                                btfsc    v__status, v__z
>>>
>>> In your last code example where you removed the function the code is:
>>>
>>>                               clrf     v_k
>>> ;   35 if k>0 & k<13 then
>>>                                movf     v_k,w
>>>                                bsf      v__bitbucket, 6 ; _btemp7
>>>                                btfsc    v__status, v__z
>>>
>>> If I am right - and I hope I am not - the first piece of code does not
>>> work because the Z flag (v__z) of the status register (v__status) is never
>>> affected by any of these instructions. In the last code example the clrf
>>> instruction sets the Z flag.
>>>
>>> In other words, moving the return value of 0 to v_i is not the same as
>>> clearing the value of v_k. So it might be a compiler bug. I wonder why it
>>> has not been discovered before.
>>>
>>> Still need to see if my draft conclusion is correct.
>>>
>>> Kind regards,
>>>
>>> Rob
>>>
>>>
>>>
>>> ------------------------------
>>> *Van:* '[email protected]' via jallib <[email protected]
>>> >
>>> *Verzonden:* donderdag 17 augustus 2023 21:07
>>> *Aan:* jallib <[email protected]>
>>> *Onderwerp:* Re: [jallib] IF statement fails
>>>
>>> Hello Rob,
>>> PIC is a 18f26K83
>>> compiler called with: ../jalv25r7/compiler/jalv2-x86-64
>>> -no-variable-reuse
>>> no other specific setting
>>> Thanks,
>>> Andreas
>>>
>>> On Thursday, August 17, 2023 at 9:00:33 PM UTC+2 Rob CJ wrote:
>>>
>>> Hi,
>>>
>>> For which PIC did you compile this? 12, 16, 18?
>>>
>>> Did you use any compiler optimizations?
>>>
>>> Thanks.
>>>
>>> Kind regards,
>>>
>>> Rob
>>>
>>> ------------------------------
>>> *Van:* '[email protected]' via jallib <[email protected]
>>> >
>>> *Verzonden:* woensdag 16 augustus 2023 22:18
>>> *Aan:* jallib <[email protected]>
>>> *Onderwerp:* [jallib] IF statement fails
>>>
>>> Hello everyone,
>>>
>>> I found this code is not working (using jal jalv25r7, but also older
>>> versions). Can anyone pls verify:
>>>
>>>
>>> *var byte i *
>>>
>>>
>>> *function test() return byte is return 0 end function*
>>>
>>> *i=test() *
>>> *if i>0 & i<13 then*
>>>
>>> *  -- goes here but is wrong *
>>> *else*
>>> * ..*
>>> *end if*
>>>
>>> but this code works:
>>>
>>> *var byte i *
>>>
>>>
>>> *function test() return byte is return 0 end function*
>>> *i=test()*
>>> *if i<13 & i>0 then*
>>>
>>> *  .. *
>>> *else*
>>>
>>> *   -- goes here and OK *
>>> *end if*
>>>
>>> if you remove the function, it works, too:
>>>
>>> *var byte i *
>>> *i=0*
>>> *if i>0 & i<13 then*
>>>
>>> *  .. *
>>> *else*
>>>  *  -- goes here and OK*
>>> *end if*
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "jallib" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to [email protected].
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/jallib/2b197dbf-4628-4acd-b13c-11e3b6ba2228n%40googlegroups.com
>>> <https://groups.google.com/d/msgid/jallib/2b197dbf-4628-4acd-b13c-11e3b6ba2228n%40googlegroups.com?utm_medium=email&utm_source=footer>
>>> .
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "jallib" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to [email protected].
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/jallib/69c9a49a-e83c-4824-a27c-074f25bf0c29n%40googlegroups.com
>>> <https://groups.google.com/d/msgid/jallib/69c9a49a-e83c-4824-a27c-074f25bf0c29n%40googlegroups.com?utm_medium=email&utm_source=footer>
>>> .
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "jallib" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to [email protected].
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/jallib/f2b66222-389b-4f41-8705-41e46aad4528n%40googlegroups.com
>>> <https://groups.google.com/d/msgid/jallib/f2b66222-389b-4f41-8705-41e46aad4528n%40googlegroups.com?utm_medium=email&utm_source=footer>
>>> .
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "jallib" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to [email protected].
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/jallib/c174132e-28a7-4383-9c2d-335a2b025082n%40googlegroups.com
>>> <https://groups.google.com/d/msgid/jallib/c174132e-28a7-4383-9c2d-335a2b025082n%40googlegroups.com?utm_medium=email&utm_source=footer>
>>> .
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "jallib" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to [email protected].
>>>
>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/jallib/GVXP195MB16376699E4BB8A93181105D7E61BA%40GVXP195MB1637.EURP195.PROD.OUTLOOK.COM
>>> <https://groups.google.com/d/msgid/jallib/GVXP195MB16376699E4BB8A93181105D7E61BA%40GVXP195MB1637.EURP195.PROD.OUTLOOK.COM?utm_medium=email&utm_source=footer>
>>> .
>>>
>> --
> You received this message because you are subscribed to the Google Groups
> "jallib" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/jallib/a4d7714c-a139-4928-9611-e43b7425619cn%40googlegroups.com
> <https://groups.google.com/d/msgid/jallib/a4d7714c-a139-4928-9611-e43b7425619cn%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"jallib" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jallib/CAM%2Bj4qs4wyM2K1hMCWT6ac8yxDNa3yLf8c4Hd-6jpp_rr1412w%40mail.gmail.com.

Reply via email to