[PATCH] D76323: [AST] Fix handling of long double and bool in __builtin_bit_cast

Erik Pilkington via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Mar 17 14:35:17 PDT 2020


erik.pilkington created this revision.
erik.pilkington added reviewers: rsmith, ldionne, jfb.
Herald added subscribers: ributzka, dexonsmith, jkorous.

On x86, `long double` has 6 unused trailing bytes. This patch changes the constant evaluator to treat them as though they were padding bytes, so reading from them results in an indeterminate value, and nothing is written for them. Also, fix a similar bug with bool, but instead of treating the unused bits as padding, enforce that they're zero.

Fixes a bug Louis pointed out in: https://reviews.llvm.org/D75960


https://reviews.llvm.org/D76323

Files:
  clang/include/clang/Basic/DiagnosticASTKinds.td
  clang/lib/AST/ExprConstant.cpp
  clang/test/SemaCXX/constexpr-builtin-bit-cast.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D76323.250865.patch
Type: text/x-patch
Size: 5903 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200317/13578a09/attachment-0001.bin>


More information about the cfe-commits mailing list