Menu

#318 ELIF is not ELSE IF, bug or unusual name?

None
closed-accepted
None
1
2022-02-19
2021-08-04
No

Surprisingly I just realized that a chain of IF/ELIF/ENDIF will happily assemble all sections:

  org 0
v equ 5
  if (v==5)
   movlw 5
  elif (v!=0)
   movlw 0
  endif
  end

Both of the conditional paths are taken in gpasm-1.5.2 #1319 (Aug 1 2021)

                      00003   if (v==5)
0000   0C05           00004    movlw 5
                      00005   elif (v!=0)
0001   0C00           00006    movlw 0
                      00007   endif

Is this by design or a bug? It at least surprised me because I assumed that "EL" in ELIF stood for "ELSE", but after reading the documentation it is not all clear that ELIF is mutually exclusive...

Discussion

  • Robert Pearce

    Robert Pearce - 2022-02-18

    I agree that looks like a bug - your interpretation of "elif" matches everyone else's, even if the gputils documentation is rather vague on the subject. I believe the fix is fairly simple, it just needs applying in several places. The attached patch should do it.

     
  • Molnár Károly

    Molnár Károly - 2022-02-19
    • status: open --> closed-accepted
    • assigned_to: Molnár Károly
     
  • Molnár Károly

    Molnár Károly - 2022-02-19

    Fixed in svn version [r1328]. Thanks for the bug report and the patch.

    Károly

     

    Related

    Commit: [r1328]

Anonymous
Anonymous

Add attachments
Cancel





MongoDB Logo MongoDB