https://llvm.org/bugs/show_bug.cgi?id=23413

            Bug ID: 23413
           Summary: UBSan reports downcast/upcast of misaligned address in
                    std::set<long long>
           Product: clang
           Version: 3.6
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: -New Bugs
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected]
    Classification: Unclassified

Created attachment 14283
  --> https://llvm.org/bugs/attachment.cgi?id=14283&action=edit
Test program and output after building with Clang 3.6 (using GCC toolchain 4.9)

Using `long long' as std::set's value type causes UBSan as included in Clang
3.5 and 3.6 to report an downcast/upcast of a misaligned address at runtime.

Platform: Debian 8 (Jessie) on Intel x86 (32 bit)
C++ library: libstdc++

Reproduced using:

- Clang 3.5 w/ GCC toolchain 4.9
- Clang 3.6 w/ GCC toolchain 4.9
- Clang 3.6 w/ GCC toolchain 5.1.0

The issue does not occur with libc++. Shorter value types for std::set, e.g.
`long' or `char', work. Packaging the `long long' in another type, e.g. a
struct, works too.

The fact that this is not reproducible when building with GCC 5.1.0 (with
-fsanitize=alignment) and neither when compiling for x86-64 leads me to believe
that this is an issue in Clang's implementation of UBSan.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs

Reply via email to