#
e4163c09 |
| 11-Jul-2024 |
Budimir Aranđelović <123091736+budimirarandjelovicsyrmia@users.noreply.github.com> |
[clang] Emit bad shift warnings (#70307)
Diagnose bad shifts and emit warnings
|
Revision tags: llvmorg-18.1.8, llvmorg-18.1.7, llvmorg-18.1.6, llvmorg-18.1.5, llvmorg-18.1.4, llvmorg-18.1.3, llvmorg-18.1.2, llvmorg-18.1.1 |
|
#
c00c901f |
| 05-Mar-2024 |
Atousa Duprat <atousa.p@gmail.com> |
[clang] Use separator for large numeric values in overflow diagnostic (#80939)
Add functionality to APInt::toString() that allows it to insert
separators between groups of digits, using the C++ lit
[clang] Use separator for large numeric values in overflow diagnostic (#80939)
Add functionality to APInt::toString() that allows it to insert
separators between groups of digits, using the C++ literal
separator ' between groups.
Fixes issue #58228
Reviewers: @AaronBallman, @cjdb, @tbaederr
show more ...
|
Revision tags: llvmorg-18.1.0, llvmorg-18.1.0-rc4, llvmorg-18.1.0-rc3, llvmorg-18.1.0-rc2, llvmorg-18.1.0-rc1, llvmorg-19-init, llvmorg-17.0.6, llvmorg-17.0.5, llvmorg-17.0.4, llvmorg-17.0.3, llvmorg-17.0.2, llvmorg-17.0.1, llvmorg-17.0.0, llvmorg-17.0.0-rc4, llvmorg-17.0.0-rc3, llvmorg-17.0.0-rc2, llvmorg-17.0.0-rc1, llvmorg-18-init, llvmorg-16.0.6, llvmorg-16.0.5, llvmorg-16.0.4, llvmorg-16.0.3, llvmorg-16.0.2, llvmorg-16.0.1, llvmorg-16.0.0, llvmorg-16.0.0-rc4, llvmorg-16.0.0-rc3, llvmorg-16.0.0-rc2, llvmorg-16.0.0-rc1, llvmorg-17-init, llvmorg-15.0.7, llvmorg-15.0.6, llvmorg-15.0.5, llvmorg-15.0.4 |
|
#
b76219b5 |
| 20-Oct-2022 |
Bill Wendling <morbo@google.com> |
[clang][Sema] Use correct array size for diagnostic
The diagnostic was confusing and reporting that an array contains far more elements than it is defined to have, due to casting.
For example, this
[clang][Sema] Use correct array size for diagnostic
The diagnostic was confusing and reporting that an array contains far more elements than it is defined to have, due to casting.
For example, this code:
double foo[4096]; ((char*)foo)[sizeof(foo)];
warns that the "index 32768 is past the end of the array (which contains 32768 elements)."
Reviewed By: serge-sans-paille, aaron.ballman
Differential Revision: https://reviews.llvm.org/D135920
show more ...
|
Revision tags: llvmorg-15.0.3, working, llvmorg-15.0.2, llvmorg-15.0.1, llvmorg-15.0.0, llvmorg-15.0.0-rc3, llvmorg-15.0.0-rc2, llvmorg-15.0.0-rc1, llvmorg-16-init, llvmorg-14.0.6, llvmorg-14.0.5, llvmorg-14.0.4, llvmorg-14.0.3, llvmorg-14.0.2, llvmorg-14.0.1, llvmorg-14.0.0, llvmorg-14.0.0-rc4, llvmorg-14.0.0-rc3, llvmorg-14.0.0-rc2, llvmorg-14.0.0-rc1 |
|
#
8c5edb59 |
| 04-Feb-2022 |
Aaron Ballman <aaron@aaronballman.com> |
Use functions with prototypes when appropriate; NFC
A significant number of our tests in C accidentally use functions without prototypes. This patch converts the function signatures to have a protot
Use functions with prototypes when appropriate; NFC
A significant number of our tests in C accidentally use functions without prototypes. This patch converts the function signatures to have a prototype for the situations where the test is not specific to K&R C declarations. e.g.,
void func();
becomes
void func(void);
This is the second batch of tests being updated (there are a significant number of other tests left to be updated).
show more ...
|
Revision tags: llvmorg-15-init, llvmorg-13.0.1, llvmorg-13.0.1-rc3, llvmorg-13.0.1-rc2, llvmorg-13.0.1-rc1, llvmorg-13.0.0, llvmorg-13.0.0-rc4, llvmorg-13.0.0-rc3, llvmorg-13.0.0-rc2, llvmorg-13.0.0-rc1, llvmorg-14-init, llvmorg-12.0.1, llvmorg-12.0.1-rc4, llvmorg-12.0.1-rc3, llvmorg-12.0.1-rc2, llvmorg-12.0.1-rc1, llvmorg-12.0.0, llvmorg-12.0.0-rc5, llvmorg-12.0.0-rc4 |
|
#
3315bd0b |
| 18-Mar-2021 |
Richard Smith <richard@metafoo.co.uk> |
PR49619: Remove delayed call to noteFailed.
This would assert if we hit the evaluation step limit between starting to delay the call and finishing. In any case, delaying the call was largely pointle
PR49619: Remove delayed call to noteFailed.
This would assert if we hit the evaluation step limit between starting to delay the call and finishing. In any case, delaying the call was largely pointless as it doesn't really matter when we mark the evaluation as having had side effects.
show more ...
|
Revision tags: llvmorg-12.0.0-rc3, llvmorg-12.0.0-rc2, llvmorg-11.1.0, llvmorg-11.1.0-rc3, llvmorg-12.0.0-rc1, llvmorg-13-init, llvmorg-11.1.0-rc2, llvmorg-11.1.0-rc1, llvmorg-11.0.1, llvmorg-11.0.1-rc2, llvmorg-11.0.1-rc1, llvmorg-11.0.0, llvmorg-11.0.0-rc6, llvmorg-11.0.0-rc5, llvmorg-11.0.0-rc4, llvmorg-11.0.0-rc3, llvmorg-11.0.0-rc2, llvmorg-11.0.0-rc1, llvmorg-12-init, llvmorg-10.0.1, llvmorg-10.0.1-rc4, llvmorg-10.0.1-rc3, llvmorg-10.0.1-rc2, llvmorg-10.0.1-rc1, llvmorg-10.0.0, llvmorg-10.0.0-rc6, llvmorg-10.0.0-rc5, llvmorg-10.0.0-rc4, llvmorg-10.0.0-rc3, llvmorg-10.0.0-rc2, llvmorg-10.0.0-rc1, llvmorg-11-init, llvmorg-9.0.1, llvmorg-9.0.1-rc3, llvmorg-9.0.1-rc2, llvmorg-9.0.1-rc1, llvmorg-9.0.0, llvmorg-9.0.0-rc6, llvmorg-9.0.0-rc5, llvmorg-9.0.0-rc4, llvmorg-9.0.0-rc3, llvmorg-9.0.0-rc2, llvmorg-9.0.0-rc1, llvmorg-10-init, llvmorg-8.0.1, llvmorg-8.0.1-rc4, llvmorg-8.0.1-rc3, llvmorg-8.0.1-rc2, llvmorg-8.0.1-rc1, llvmorg-8.0.0, llvmorg-8.0.0-rc5, llvmorg-8.0.0-rc4, llvmorg-8.0.0-rc3, llvmorg-7.1.0, llvmorg-7.1.0-rc1, llvmorg-8.0.0-rc2, llvmorg-8.0.0-rc1, llvmorg-7.0.1, llvmorg-7.0.1-rc3, llvmorg-7.0.1-rc2, llvmorg-7.0.1-rc1 |
|
#
3b6ae576 |
| 18-Oct-2018 |
David Bolvansky <david.bolvansky@gmail.com> |
[Diagnostics] Check for integer overflow in array size expressions
Summary: Fixes PR27439
Reviewers: rsmith, Rakete1111
Reviewed By: rsmith
Subscribers: Rakete1111, cfe-commits
Differential Rev
[Diagnostics] Check for integer overflow in array size expressions
Summary: Fixes PR27439
Reviewers: rsmith, Rakete1111
Reviewed By: rsmith
Subscribers: Rakete1111, cfe-commits
Differential Revision: https://reviews.llvm.org/D52750
llvm-svn: 344759
show more ...
|
Revision tags: llvmorg-7.0.0, llvmorg-7.0.0-rc3, llvmorg-7.0.0-rc2, llvmorg-7.0.0-rc1, llvmorg-6.0.1, llvmorg-6.0.1-rc3, llvmorg-6.0.1-rc2, llvmorg-6.0.1-rc1, llvmorg-5.0.2, llvmorg-5.0.2-rc2 |
|
#
ca7902f7 |
| 27-Mar-2018 |
Volodymyr Sapsai <vsapsai@apple.com> |
[Sema] Emit -Winteger-overflow for arguments in function calls, ObjC messages.
rdar://problem/35539384
Reviewers: ahatanak, nicholas, rsmith, jkorous-apple
Reviewed By: jkorous-apple
Subscribers:
[Sema] Emit -Winteger-overflow for arguments in function calls, ObjC messages.
rdar://problem/35539384
Reviewers: ahatanak, nicholas, rsmith, jkorous-apple
Reviewed By: jkorous-apple
Subscribers: cfe-commits, jkorous-apple
Differential Revision: https://reviews.llvm.org/D42938
llvm-svn: 328671
show more ...
|
Revision tags: llvmorg-5.0.2-rc1, llvmorg-6.0.0, llvmorg-6.0.0-rc3, llvmorg-6.0.0-rc2, llvmorg-6.0.0-rc1, llvmorg-5.0.1, llvmorg-5.0.1-rc3, llvmorg-5.0.1-rc2, llvmorg-5.0.1-rc1, llvmorg-5.0.0, llvmorg-5.0.0-rc5, llvmorg-5.0.0-rc4, llvmorg-5.0.0-rc3, llvmorg-5.0.0-rc2, llvmorg-5.0.0-rc1 |
|
#
9f7df0c0 |
| 26-Jun-2017 |
Richard Smith <richard-llvm@metafoo.co.uk> |
Revert r301742, which caused us to try to evaluate all full-expressions.
Also add testcases for a bunch of expression forms that cause our evaluator to crash. See PR33140 and PR32864 for crashes tha
Revert r301742, which caused us to try to evaluate all full-expressions.
Also add testcases for a bunch of expression forms that cause our evaluator to crash. See PR33140 and PR32864 for crashes that this was causing.
This reverts r305287, which reverted r305239, which reverted r301742. The previous revert claimed that buildbots were broken, but did not add any testcases and the buildbots have lost all memory of what was wrong here.
Changes to test/OpenMP are not reverted; another change has triggered those tests to change their output in the same way that r301742 did.
llvm-svn: 306346
show more ...
|
#
bec724cb |
| 13-Jun-2017 |
Diana Picus <diana.picus@linaro.org> |
Revert "Revert r301742 which made ExprConstant checking apply to all full-exprs."
This reverts commit r305239 because it broke the buildbots (the diag-flags.cpp test is failing).
llvm-svn: 305287
|
Revision tags: llvmorg-4.0.1, llvmorg-4.0.1-rc3 |
|
#
54992386 |
| 12-Jun-2017 |
Nick Lewycky <nicholas@mxc.ca> |
Revert r301742 which made ExprConstant checking apply to all full-exprs.
This patch also exposed pre-existing bugs in clang, see PR32864 and PR33140#c3 .
llvm-svn: 305239
|
#
13073a64 |
| 12-Jun-2017 |
Nick Lewycky <nicholas@mxc.ca> |
Revert r303316, a change to ExprConstant to evaluate function arguments.
The patch was itself correct but it uncovered other bugs which are going to be difficult to fix, per PR33140.
llvm-svn: 3052
Revert r303316, a change to ExprConstant to evaluate function arguments.
The patch was itself correct but it uncovered other bugs which are going to be difficult to fix, per PR33140.
llvm-svn: 305233
show more ...
|
Revision tags: llvmorg-4.0.1-rc2 |
|
#
9add1594 |
| 17-May-2017 |
Nick Lewycky <nicholas@mxc.ca> |
The constant expression evaluator should examine function arguments for non-constexpr function calls unless the EvalInfo says to stop.
llvm-svn: 303317
|
#
c190f96b |
| 02-May-2017 |
Nick Lewycky <nicholas@mxc.ca> |
Revert r301785 (and r301787) because they caused PR32864.
The fix is that ExprEvaluatorBase::VisitInitListExpr should handle transparent exprs instead of exprs with one element. Fixing that uncovers
Revert r301785 (and r301787) because they caused PR32864.
The fix is that ExprEvaluatorBase::VisitInitListExpr should handle transparent exprs instead of exprs with one element. Fixing that uncovers one testcase failure because the AST for "constexpr _Complex float test2 = {1};" is wrong (the _Complex prvalue should not be const-qualified), and a number of test failures in test/OpenMP where the captured stmt contains an InitListExpr that is in syntactic form.
llvm-svn: 301891
show more ...
|
#
49675ac4 |
| 01-May-2017 |
Nick Lewycky <nicholas@mxc.ca> |
Fix test that was incorrected merged between patches.
llvm-svn: 301787
|
#
499968f8 |
| 01-May-2017 |
Nick Lewycky <nicholas@mxc.ca> |
Handle expressions with non-literal types like ignored expressions if we are supposed to continue evaluating them.
Also fix a crash casting a derived nullptr to a virtual base.
llvm-svn: 301785
|
#
e7d6fbdf |
| 29-Apr-2017 |
Nick Lewycky <nicholas@mxc.ca> |
Remove Sema::CheckForIntOverflow, and instead check all full-expressions.
CheckForIntOverflow used to implement a whitelist of top-level expressions to send to the constant expression evaluator, whi
Remove Sema::CheckForIntOverflow, and instead check all full-expressions.
CheckForIntOverflow used to implement a whitelist of top-level expressions to send to the constant expression evaluator, which handled many more expressions than the CheckForIntOverflow whitelist did.
llvm-svn: 301742
show more ...
|
Revision tags: llvmorg-4.0.1-rc1 |
|
#
ad888689 |
| 27-Apr-2017 |
Nick Lewycky <nicholas@mxc.ca> |
In the expression evaluator, visit the index of an ArraySubscriptExpr even if we can't evaluate the base, if the evaluation mode tells us to continue evaluation.
llvm-svn: 301522
|
#
20edee6a |
| 27-Apr-2017 |
Nick Lewycky <nicholas@mxc.ca> |
In the expression evaluator, descend into both the true and false expressions of a ConditionalOperator when the condition can't be evaluated and we're in an evaluation mode that says we should contin
In the expression evaluator, descend into both the true and false expressions of a ConditionalOperator when the condition can't be evaluated and we're in an evaluation mode that says we should continue evaluating.
llvm-svn: 301520
show more ...
|
Revision tags: llvmorg-4.0.0, llvmorg-4.0.0-rc4, llvmorg-4.0.0-rc3, llvmorg-4.0.0-rc2, llvmorg-4.0.0-rc1, llvmorg-3.9.1, llvmorg-3.9.1-rc3, llvmorg-3.9.1-rc2, llvmorg-3.9.1-rc1, llvmorg-3.9.0, llvmorg-3.9.0-rc3, llvmorg-3.9.0-rc2, llvmorg-3.9.0-rc1, llvmorg-3.8.1, llvmorg-3.8.1-rc1 |
|
#
729c8e97 |
| 11-Apr-2016 |
Richard Trieu <rtrieu@google.com> |
Adjust tests to have consistent integer sizes.
Add a triple to the run lines so that integers will the same sizes across runs. Also add a compile time check to ensure the assumptions about sizes are
Adjust tests to have consistent integer sizes.
Add a triple to the run lines so that integers will the same sizes across runs. Also add a compile time check to ensure the assumptions about sizes are met.
llvm-svn: 265991
show more ...
|
Revision tags: llvmorg-3.8.0, llvmorg-3.8.0-rc3 |
|
#
dfe2156f |
| 10-Feb-2016 |
Akira Hatanaka <ahatanaka@apple.com> |
[Sema] Issue a warning for integer overflow in nested struct initializer
r257357 fixed clang to warn on integer overflow in struct initializers. However, it didn't warn when a struct had a nested in
[Sema] Issue a warning for integer overflow in nested struct initializer
r257357 fixed clang to warn on integer overflow in struct initializers. However, it didn't warn when a struct had a nested initializer. This commit makes changes in Sema::CheckForIntOverflow to handle nested initializers.
For example:
struct s { struct t { unsigned x; } t; } s = { { .x = 4 * 1024 * 1024 * 1024 } };
rdar://problem/23526454
llvm-svn: 260360
show more ...
|
Revision tags: llvmorg-3.8.0-rc2, llvmorg-3.8.0-rc1 |
|
#
f5c13618 |
| 11-Jan-2016 |
Akira Hatanaka <ahatanaka@apple.com> |
[Sema] Issue a warning for integer overflow in struct initializer
Clang wasn't issuing a warning when compiling the following code:
struct s { unsigned x; } s = { .x = 4 * 1024 * 1024 * 1024 };
[Sema] Issue a warning for integer overflow in struct initializer
Clang wasn't issuing a warning when compiling the following code:
struct s { unsigned x; } s = { .x = 4 * 1024 * 1024 * 1024 };
rdar://problem/23399683
Differential Revision: http://reviews.llvm.org/D15097
llvm-svn: 257357
show more ...
|
#
ce8eca57 |
| 08-Dec-2015 |
Richard Smith <richard-llvm@metafoo.co.uk> |
Explicitly permit undefined behavior in constant initializers for global variables in C, in the cases where we can constant-fold it to a value regardless (such as floating-point division by zero and
Explicitly permit undefined behavior in constant initializers for global variables in C, in the cases where we can constant-fold it to a value regardless (such as floating-point division by zero and signed integer overflow). Strictly enforcing this rule breaks too much code.
llvm-svn: 254992
show more ...
|
#
0c6124ba |
| 03-Dec-2015 |
Richard Smith <richard-llvm@metafoo.co.uk> |
PR17381: Treat undefined behavior during expression evaluation as an unmodeled side-effect, so that we don't allow speculative evaluation of such expressions during code generation.
This caused a di
PR17381: Treat undefined behavior during expression evaluation as an unmodeled side-effect, so that we don't allow speculative evaluation of such expressions during code generation.
This caused a diagnostic quality regression, so fix constant expression diagnostics to prefer either the first "can't be constant folded" diagnostic or the first "not a constant expression" diagnostic depending on the kind of evaluation we're doing. This was always the intent, but didn't quite work correctly before.
This results in certain initializers that used to be constant initializers to no longer be; in particular, things like:
float f = 1e100;
are no longer accepted in C. This seems appropriate, as such constructs would lead to code being executed if sanitizers are enabled.
llvm-svn: 254574
show more ...
|
Revision tags: llvmorg-3.7.1, llvmorg-3.7.1-rc2, llvmorg-3.7.1-rc1, llvmorg-3.7.0, llvmorg-3.7.0-rc4, llvmorg-3.7.0-rc3, studio-1.4, llvmorg-3.7.0-rc2, llvmorg-3.7.0-rc1, llvmorg-3.6.2, llvmorg-3.6.2-rc1, llvmorg-3.6.1, llvmorg-3.6.1-rc1, llvmorg-3.5.2, llvmorg-3.5.2-rc1, llvmorg-3.6.0, llvmorg-3.6.0-rc4, llvmorg-3.6.0-rc3 |
|
#
4d1a79b8 |
| 04-Feb-2015 |
Josh Magee <joshua_magee@playstation.sony.com> |
Catch more cases when diagnosing integer-constant-expression overflows.
When visiting AssignmentOps, keep evaluating after a failure (when possible) in order to identify overflow in subexpressions.
Catch more cases when diagnosing integer-constant-expression overflows.
When visiting AssignmentOps, keep evaluating after a failure (when possible) in order to identify overflow in subexpressions.
Differential Revision: http://reviews.llvm.org/D1238
llvm-svn: 228202
show more ...
|