Skip to content
  • Jonas Maebe's avatar
    default values: store as staticvarsyms in staticsymtable · 50040a2c
    Jonas Maebe authored
    Previously, they were stored as localvarsyms in either the localsymtable
    (for procedures/functions) or as localvarsyms in the staticsymtable (for
    init/fini code of units/main programs). The latter was a hack (staticsymtables
    normally cannot contain localvarsyms) and caused the temp allocator to also
    allocate them as a local in fini code even if the default was only in the init
    code.
    
    The new approach ensures at most one copy gets allocated per unit, it doesn't
    require explicit initialisation (since staticvarsyms are in bss -> zeroed by
    default), gets rid of the localvarsyms in staticsymtables, and as a bonus
    solves an issue with inconsistent LLVM debug information for the localvarsym
    in init/fini code (since the staticsymtable is shared between the init and
    fini code, so was the local, and therefore we generated debug info stating
    it was defined in the fini code but within the scope of the init code).
    
    Resolves #40395
    50040a2c