[llvm-bugs] [Bug 47055] New: Incorrect codegen for enum with bool underlying type
via llvm-bugs
llvm-bugs at lists.llvm.org
Sat Aug 8 06:25:14 PDT 2020
https://bugs.llvm.org/show_bug.cgi?id=47055
Bug ID: 47055
Summary: Incorrect codegen for enum with bool underlying type
Product: clang
Version: unspecified
Hardware: PC
OS: Windows NT
Status: NEW
Severity: normal
Priority: P
Component: C++11
Assignee: unassignedclangbugs at nondot.org
Reporter: aaron at aaronballman.com
CC: blitzrakete at gmail.com, dgregor at apple.com,
erik.pilkington at gmail.com, llvm-bugs at lists.llvm.org,
richard-llvm at metafoo.co.uk
Consider the following code that appears to be valid C++11:
enum E : bool { Zero, One };
int f(int x) {
return (E)x;
}
Generates the following at -O0:
f(int): # @f(int)
push rbp
mov rbp, rsp
mov dword ptr [rbp - 4], edi
mov eax, dword ptr [rbp - 4]
and al, 1
movzx eax, al
pop rbp
ret
We are ANDing x with 0x1 rather than comparing it against zero as required by
[conv.bool] and [expr.static.cast]p10.
--
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/20200808/f41a2f10/attachment.html>
More information about the llvm-bugs
mailing list