Skip to content

Wrong output for the initialization of static variables within a function #507

@Redstone1024

Description

@Redstone1024

For the initialization of static variables within functions, based on comparison with assembly output and analysis, I believe that a call to __cxa_atexit should be included, otherwise the class object cannot be destructured on program exit.

The following references are used in the analysis process.

C++ Insights

Compiler Explorer

This function call is missing.

mov     edx, OFFSET FLAT:__dso_handle
mov     esi, OFFSET FLAT:_ZZ11get_examplevE4temp
mov     edi, OFFSET FLAT:_ZN14example_structD1Ev
call    __cxa_atexit

Translated with DeepL.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions