#116 Fix # 1963382


To fix the problem I made the follwoing change:
In SDCC.y : added copying of LineNo of condition ($3) to lineno of $1
As soon as the complete if-statement is parsed the creatIfx function is called to create the ast tree for the full if-statement. At that moment the lineno is 22
(the end of the if statenment).
From the 'while'-statement parsing in the .y file one can see that there the lineno is retrieved from $1->lineDef. As my knowlegde of yacc (bison) is limited, I don't
know what $1 refers to, so I tried first the same construction, but $1 is not defined in the context of the IF statement. However $3 refers to the condition of the if statement which usually starts at the same line as the if, so I added that to the code.
However, I am aware that it is a kind of 'best guess'. I don't know how to obtain the lineno where the if statement started from the bison environment.

I did add the piece of code that was added to the bugreport as a separate bug code file for regresssion However, it is not clear to me how I can implement a useful check to prevent this error from happening again.



  • RvS

    RvS - 2008-08-13
  • Borut Ražem

    Borut Ražem - 2008-08-24

    Logged In: YES
    Originator: NO

    Patch applied in svn revision #5219.

    The regression test was not added since there is no way to automatically check the correctness of the .lst file.


  • Borut Ražem

    Borut Ražem - 2008-08-24
    • assigned_to: nobody --> borutr
    • status: open --> closed-accepted

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.

No, thanks