#1106 local variable globally visible


SDCC appends "::" instead of ":" to local variables in
the assembly code.

The "::" is interpreted as a global label by the

This can be used to provoke a name clash.

> sdcc -c float.c
> sdcc -c float2.c
> sdcc float.rel float2.rel
Multiple definition of _test_c_1_1

Files are attached.


  • Frieder Ferlemann

  • Frieder Ferlemann

    • labels: --> 101550
  • Maarten Brock

    Maarten Brock - 2006-04-27

    Logged In: YES

    Is this always the case or only when --debug is used? I
    guess the symbol must be globally visible if you want to
    view it in a debugger. Maybe it should also be prepended
    with the name of the object?

    I'm just guessing here. I have no idea how it actually

  • Frieder Ferlemann

    Logged In: YES

    > Is this always the case or only when --debug is used?

    Always. The command line I used is in the report. If --debug
    is additionally used then another name clash occurs:

    Multiple definition of _test_c_1_1
    Multiple definition of Ltest$c$1$1

  • Hubert Sack

    Hubert Sack - 2006-05-01

    Logged In: YES

    I created a patch (#1479782) which solves the problem

  • Maarten Brock

    Maarten Brock - 2006-05-01

    Logged In: YES

    Thanks Hubert,

    The patch looks good but solves only half the problem.

    When --debug is used there still is a name clash. It could
    be solved by adding the module name and thus changing
    Ltest$c$1$1 to Lfloat2test$1$1. But this output is not
    there without a reason so it requires a patch of the
    linker too. And maybe even the debugger.

    But there seems even more to it. If I add a static
    variable to the top of float2.c the name clash disappears!
    This needs more investigation.


  • Maarten Brock

    Maarten Brock - 2011-03-18

    Fixed in SDCC 3.0.1 #6311.

    Patch did not yet fix overlay segment.
    Disappearing name clash was already fixed.
    Fixed debug symbols by prepending (static) function names with the module name separated by '.'

  • Maarten Brock

    Maarten Brock - 2011-03-18
    • labels: 101550 -->
    • milestone: --> fixed
    • assigned_to: nobody --> maartenbrock
    • status: open --> closed-fixed

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

Sign up for the SourceForge newsletter:

No, thanks