[llvm-bugs] [Bug 42796] New: UBSan (enum) failure on <regex> implementation of MSVC
via llvm-bugs
llvm-bugs at lists.llvm.org
Sat Jul 27 13:25:03 PDT 2019
https://bugs.llvm.org/show_bug.cgi?id=42796
Bug ID: 42796
Summary: UBSan (enum) failure on <regex> implementation of MSVC
Product: clang
Version: trunk
Hardware: PC
OS: Windows NT
Status: NEW
Severity: enhancement
Priority: P
Component: -New Bugs
Assignee: unassignedclangbugs at nondot.org
Reporter: jvapen at gmail.com
CC: htmldeveloper at gmail.com, llvm-bugs at lists.llvm.org,
neeilans at live.com, richard-llvm at metafoo.co.uk
The following case is reduced from the std::regex_search() of MSVC2017.
Compiler explorer: https://godbolt.org/z/OZKIJV
// clang++ -std=c++2a -fsanitize=enum
enum E
{
A = 1,
B = 2,
C = 4,
};
constexpr E operator&(E _Left, E _Right) noexcept
{
return (static_cast<E>(static_cast<int>(_Left) &
static_cast<int>(_Right)));
}
constexpr E operator~(E _Left) noexcept
{
return (static_cast<E>(~static_cast<int>(_Left)));
}
int main()
{
E e = E::A;
e = (e & ~E::C);
}
>> example.cpp:10:68: runtime error: load of value 4294967291, which is not a valid value for type 'E'
--
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/20190727/59554d79/attachment.html>
More information about the llvm-bugs
mailing list