#1768 Undefined identifier

closed-fixed
5
2013-05-25
2011-02-23
No

sdcc gives "Undefined identifier" errors, even though the identifier is defined. The problem has been observed in 2.7.0, 3.0.0, current trunk and optralloc, for multiple ports, by multiple people, and occours when compiling some complex C code from the contiki OS. Fortunately there is a small example that reproduces the error.

Philipp

Discussion

  • Philipp Klaus Krause

    Compiling this gives false "Undefined identifier" errors.

     
  • wek

    wek - 2011-02-23

    Can be reduced to
    void foo(void (*f)(void *));

    void bar(void) {
    }

    void main(void) {
    {
    int c;
    c = 0;
    }
    foo((void (*)(void *))bar);
    }

     
  • Philipp Klaus Krause

    Bug #3153215 is the symmetric problem: A variable exisitng outside of it's correct scope.

     
  • Maarten Brock

    Maarten Brock - 2011-09-22

    Fixed in SDCC 3.0.5 #6868.

    I removed a call to CleanupLevel in SDCC.y to fix this. I am not sure this did not break anything, but regression tests are fine.

     
  • Maarten Brock

    Maarten Brock - 2011-09-22
    • labels: --> C-Front End
    • milestone: --> fixed
    • assigned_to: nobody --> maartenbrock
    • status: open --> closed-fixed
     
  • Erik Petrich

    Erik Petrich - 2012-12-26

    Removing the call to cleanUpLevel() fixes the undefined identifier errors, but it also had the side-effect of leaving parameter names of a function pointer type declaration active in the symbol table. With my changes in revision #8280 the parameter names are only added to the symbol table when defining a full function (with body), so the call to cleanUpLevel() is now definitely superfluous.

     

Log in to post a comment.