Skip to content

clang emits useless guard variable for static const value #164134

@Matheus28

Description

@Matheus28

Please see https://godbolt.org/z/K6bM5qfx3 and compare the gcc and clang output

The compiler is able to calculate the pow results at compile time, however it still issues a __cxa_guard_acquire/__cxa_guard_release pair just to move those values around in memory. Meanwhile, gcc is able to use the .rodata section directly.

Metadata

Metadata

Assignees

No one assigned

    Labels

    clang:frontendLanguage frontend issues, e.g. anything involving "Sema"constexprAnything related to constant evaluation

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions