Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clang Address & UndefinedBehaviour sanitizers warnings #308

Closed
snizovtsev opened this issue Apr 26, 2016 · 4 comments
Closed

Clang Address & UndefinedBehaviour sanitizers warnings #308

snizovtsev opened this issue Apr 26, 2016 · 4 comments

Comments

@snizovtsev
Copy link

When compiling with clang sanitizers enabled cppformat code constantly produce this warnings:

    /nix/store/ngq27j3v7jqa55f9dfd01b1cs5wg83s9-libc++-3.7.1/include/c++/v1/__tree:836:16: runtime error: downcast of misaligned address 0x7fff50e59148 for type 'std::__1::__tree_node<std::__1::__value_type<fmt::BasicStringRef<char>, fmt::internal::Arg>, void *>', which requires 16 byte alignment
    0x7fff50e59148: note: pointer points here
     ff 7f 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  30 93 e5 50 ff 7f 00 00  30 93 e5 50
                  ^
    SUMMARY: AddressSanitizer: undefined-behavior /nix/store/ngq27j3v7jqa55f9dfd01b1cs5wg83s9-libc++-3.7.1/include/c++/v1/__tree:836:16 in
    /nix/store/ngq27j3v7jqa55f9dfd01b1cs5wg83s9-libc++-3.7.1/include/c++/v1/__tree:877:51: runtime error: upcast of misaligned address 0x7fff50e59148 for type 'std::__1::__tree_node<std::__1::__value_type<fmt::BasicStringRef<char>, fmt::internal::Arg>, void *>', which requires 16 byte alignment
    0x7fff50e59148: note: pointer points here
     ff 7f 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  30 93 e5 50 ff 7f 00 00  30 93 e5 50
                  ^
    SUMMARY: AddressSanitizer: undefined-behavior /nix/store/ngq27j3v7jqa55f9dfd01b1cs5wg83s9-libc++-3.7.1/include/c++/v1/__tree:877:51 in

I don't know is it bug or not but i consider this potentially harmful.

$ c++ --version
clang version 3.7.1 (tags/RELEASE_371/final)
Target: x86_64-apple-darwin15.4.0
Thread model: posix

Compiled with -fsanitize=address -fsanitize=undefined.

@vitaut
Copy link
Contributor

vitaut commented Apr 27, 2016

Could you give an example of the code that produces these warnings? Also which version of the library do you use?

@vitaut
Copy link
Contributor

vitaut commented Apr 29, 2016

OK, I've managed to reproduce this issue on the following code which uses a named argument:

  fmt::print("{a}", fmt::arg("a", 42));

This has been fixed in master already.

@vitaut vitaut closed this as completed Apr 29, 2016
@dio
Copy link

dio commented Jan 14, 2019

@vitaut I'm curious on how to fix this kind of issue. Could you point out the exact commit that fixes the issue? Thanks!

@vitaut
Copy link
Contributor

vitaut commented Jan 14, 2019

Unfortunately I don't recall which commit fixed that. Are you seeing the same issue with an old version of {fmt}?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants