#12 %elif does not seem to be functional

closed-fixed
None
9
2002-05-22
2002-05-21
Charles Bilyue
No

I noticed this when attempting to build a program with
a fairly large amount of NASM code with 0.98.31 (was,
and still am, using 0.98).

My code is using a macro which uses an %if/%elif
(multiple)/%else/%endif chain. 0.98 has no trouble
with it, but in 0.98.31, even with -O0, if the %if
does not resolve to true, then the %elif's seem to be
ignored, and the %else is never reached. The code
STILL compiles without flagging an error, but
generates invalid code. If no %elif is present, %else
appears to function corectly.

My project's code specifies an %if and multiple %elif
cases which all generate code, followed by an %else
which flags an %error, if it's reached. I'm attaching
a source file which, while not using multiple %elif's,
still shows the error in the generated code. It also
shows that an %else without %elif works fine. Source
is for a bin format output (DOS .COM file).

Thank you for your time,
Charles Bilyue'

Discussion

  • Charles Bilyue
    Charles Bilyue
    2002-05-21

    • priority: 5 --> 8
    • summary: %elif does not see to be functional --> %elif does not seem to be functional
     
  • Charles Bilyue
    Charles Bilyue
    2002-05-21

    NASM input file exhibiting %elif malfunction

     
    Attachments
  • Charles Bilyue
    Charles Bilyue
    2002-05-21

    NASM input file exhibiting %elif malfunction

     
    Attachments
  • H. Peter Anvin
    H. Peter Anvin
    2002-05-22

    • assigned_to: nobody --> hpa
    • priority: 8 --> 9
    • status: open --> open-accepted
     
  • H. Peter Anvin
    H. Peter Anvin
    2002-05-22

    Logged In: YES
    user_id=58697

    I'll take a look at this. I'm labelling this as priority 9;
    this seems to be an absolute showstopper.

    I have verified this bug with top of tree.

     
  • H. Peter Anvin
    H. Peter Anvin
    2002-05-22

    Logged In: YES
    user_id=58697

    I know what the problem is now... in between 0.98.30 and
    0.98.31, I observed that %if and %elif are inconsistent. In
    particular, they disagreed on the handling of positional
    parameters in the argument. It was unclear which was
    correct, and I was assuming that changing %elif to match %if
    would be less likely to break existing code.

    The code submitted in this case gives a very good reason why
    the %elif behaviour is almost certainly the correct one. I
    will look into this.

     
  • H. Peter Anvin
    H. Peter Anvin
    2002-05-22

    Logged In: YES
    user_id=58697

    Geez, don't I feel like an idiot now. The "inconsistency"
    was actually 100% correct, but for a rather bizarre reason.
    Checked in fix with a very big comment explaining why the
    apparently inconsistent code is actually correct.

     
  • H. Peter Anvin
    H. Peter Anvin
    2002-05-22

    • status: open-accepted --> closed-fixed