Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

#107 problem with parsing of extern statement

closed-fixed
Johan Knol
5
2013-05-25
2001-08-08
Anonymous
No

The parser/symbol table appears to be confused by the
extern statement in certain circumstances. In the
following code if the second extern statement is
removed all is well but with the second extern
statement in the code will not compile.

Discussion

  • Logged In: NO

    The SourceForge bug submission using attachments didn't seem
    to work, sorry about that. Here is the program referred to
    in the original bug report.

    /*
    * To show that there is a problem in SDCC with the extern
    keyword.
    * This file compiles fine with "gcc -ansi".
    *
    * With SDCC, the second extern statement causes the error
    message:
    *
    * 1021 percival:8051 |> sdcc externProblem.c
    * externProblem.c(7):error *** Duplicate symbol
    'aVariable', symbol IGNORED
    * error *** code not generated for 'main' due to
    previous errors
    * 1022 percival:8051 |>
    *
    */

    extern int aVariable ;

    int aVariable ;

    extern int aVariable ;

    int main() {
    return 0 ;
    }

     
  • Johan Knol
    Johan Knol
    2001-08-10

    Logged In: YES
    user_id=63512

    every extern after the actual declaration did this

    fixed in SDCCsymt.c:addSymChain()

    johan

     
  • Johan Knol
    Johan Knol
    2001-08-10

    • milestone: --> fixed
    • assigned_to: nobody --> johanknol
    • status: open --> closed-fixed
     
  • Russel Winder
    Russel Winder
    2001-08-21

    Logged In: YES
    user_id=304070

    I don't this bug should not have been closed. It is true
    that the parser now deals with the situation but there is
    still a serious problem that means the code does not compile:

    519 elon:8051 |> sdcc -c externProblem.c
    ?ASxxxx-Error-<mp> in line 22 of externProblem.asm
    <m> multiple definitions error
    <p> phase error: label location changing
    between passes 2 and 3
    ?ASxxxx-Error-<m> in line 24 of externProblem.asm
    <m> multiple definitions error
    removing externProblem.rel
    520 elon:8051 |>