summaryrefslogtreecommitdiffstats
path: root/clang/test/SemaCXX/builtins-overflow.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Fix constexpr __builtin_*_overflow issue when unsigned->signed operand.Erich Keane2019-05-301-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | As reported here https://bugs.llvm.org/show_bug.cgi?id=42000, it was possible to get the constexpr version of __builtin_*_overflow to give the wrong answer. This was because when extending the operands to fit the largest type (so that the math could be done), the decision on whether to sign/zero extend the operands was based on the result signedness, not on the operands signedness. In the reported case, (unsigned char)255 - (int)100 needed to have each extended to the int in order to do the math. However, when extending the first operand to 'int', we incorrectly sign extended it instead of zero extending. Thus, the result didnt fit back into the unsigned char. The fix for this was simply to choose zero/sign extension based on the sign of the operand itself. Differential Revision: https://reviews.llvm.org/D62665 llvm-svn: 362157
* Simplify test from r334650Erich Keane2018-06-131-12/+6
| | | | | | | No reason to have the 'bool' as an intermediary value, simply use the fact that curley braces enforce eval order. llvm-svn: 334652
* Implement constexpr __builtin_*_overflowErich Keane2018-06-131-0/+84
| | | | | | | | | As requested here:https://bugs.llvm.org/show_bug.cgi?id=37633 permit the __builtin_*_overflow builtins in constexpr functions. Differential Revision: https://reviews.llvm.org/D48040 llvm-svn: 334650
* Correct behavior of __builtin_*_overflow and constexpr.Erich Keane2018-06-131-0/+15
Enable these builtins to be called across a lambda boundary with captureless const/constexpr, as brought up by Eli here: https://reviews.llvm.org/D48040 Differential Revision: https://reviews.llvm.org/D48053 llvm-svn: 334597
OpenPOWER on IntegriCloud