Menu

#116 Fix # 1963382

closed-accepted
None
5
2008-08-24
2008-08-13
RvS
No

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.

Ruud

Discussion

  • RvS

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

    Borut Ražem - 2008-08-24

    Logged In: YES
    user_id=568035
    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

     
  • Borut Ražem

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

Log in to post a comment.