[LLVMbugs] [Bug 23413] New: UBSan reports downcast/upcast of misaligned address in std::set<long long>

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Mon May 4 16:46:46 PDT 2015


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: unassignedclangbugs at nondot.org
          Reporter: public at hansmi.ch
                CC: llvmbugs at cs.uiuc.edu
    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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20150504/c232a66a/attachment.html>


More information about the llvm-bugs mailing list