Skip to content

-fno-rtti causes read of zero page address #122

@melg8

Description

@melg8

If you build first example from readme with flags:

-std=c++20 -fsanitize=address -fno-rtti

And run bench test. You will get report from sanitizer about READ on zero page address.

Caused by this source line:

os.imbue(std::locale(os.getloc(), new NumSep(',')));

Seems that std::locale call under -fno-rtti is triggering this problem. I found simmilar issue on stack overflow c-locale-without-rtti

Reproducible on https://godbolt.org/z/qYfMbsjG3

I didn't found in documentation that nanobench requires rtti to be running properly. And it would be nice not to get ub when rtti is disabled.

As workaround rtti can be just enabled for bench tests alone, but this can in theory affect results.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions