[clang] [clang] Emit bad shift warnings (PR #70307)

2024-07-19 Thread Aaron Ballman via cfe-commits
AaronBallman wrote: > > > @alanzhao1 do you think it's reasonable for the workaround to only apply > > > to code in system headers, or does the NDK get included as regular > > > headers generally? > > > > > > Having it only apply to system headers should be OK - in our case, chrome > >

[clang] [clang] Emit bad shift warnings (PR #70307)

2024-07-18 Thread Eli Friedman via cfe-commits
efriedma-quic wrote: Posted #99579. https://github.com/llvm/llvm-project/pull/70307 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Emit bad shift warnings (PR #70307)

2024-07-18 Thread Alan Zhao via cfe-commits
alanzhao1 wrote: > > @alanzhao1 do you think it's reasonable for the workaround to only apply to > > code in system headers, or does the NDK get included as regular headers > > generally? > > Having it only apply to system headers should be OK - in our case, chrome > imports these headers as

[clang] [clang] Emit bad shift warnings (PR #70307)

2024-07-18 Thread Eli Friedman via cfe-commits
efriedma-quic wrote: I think the issue is the usage of "Info.EvalStatus.Diag" to determine whether we consider the expression an ICE; that's going to lead to unpredictable results, and it's not how we handle things anywhere else. Not sure what the goal of that change is. Separately,

[clang] [clang] Emit bad shift warnings (PR #70307)

2024-07-18 Thread Alexander Kornienko via cfe-commits
alexfh wrote: Now there's a different and more subtle side-effect of this patch: https://gcc.godbolt.org/z/YP3EfGern The invalid expression `1 << 59` leads to the compiler silently ignoring the in-class initializer of the static data member. https://github.com/llvm/llvm-project/pull/70307

[clang] [clang] Emit bad shift warnings (PR #70307)

2024-07-18 Thread Alexander Kornienko via cfe-commits
alexfh wrote: I see. Thanks for the explanation and for the suggestion on how to fix that. Actually, the only instance I've seen, had already been fixed upstream (https://hg.openjdk.org/jdk/jdk/rev/71495d579a65), so the impact of this compiler behavior change is quite low in my part of the

[clang] [clang] Emit bad shift warnings (PR #70307)

2024-07-18 Thread Aaron Ballman via cfe-commits
AaronBallman wrote: > Just to confirm: is this the intentional outcome of this patch? Before C++20, left shift of -1 does not produce a mathematical result that's within the range of representable values for the result type, so it's undefined behavior, and therefore not a core constant

[clang] [clang] Emit bad shift warnings (PR #70307)

2024-07-18 Thread Alexander Kornienko via cfe-commits
alexfh wrote: Just to confirm: is this the intentional outcome of this patch? https://gcc.godbolt.org/z/Kf9YK1qM3 ``` enum { a = 1<<12, b = (-1)<<13 }; ``` ``` :3:9: error: expression is not an integral constant expression 3 | b = (-1)<<13 | ^~~~ :3:13: note:

[clang] [clang] Emit bad shift warnings (PR #70307)

2024-07-15 Thread Stephan Bergmann via cfe-commits
stbergmann wrote: > That is intentional; `strlen` is not a valid constant expression in C, and so > that is technically a VLA, except we have an extension to fold it back into a > constant. Thanks for confirming. From the commit message and the changes to `clang/docs/ReleaseNotes.rst` it

[clang] [clang] Emit bad shift warnings (PR #70307)

2024-07-15 Thread Aaron Ballman via cfe-commits
AaronBallman wrote: > This started to cause > > ``` > $ cat test.c > #include > void f(void) { > char a[strlen("x")]; > (void) a; > } > ``` > > ``` > $ clang -Wall -fsyntax-only test.c > test.c:3:12: warning: variable length array folded to constant array as an > extension

[clang] [clang] Emit bad shift warnings (PR #70307)

2024-07-15 Thread Stephan Bergmann via cfe-commits
stbergmann wrote: This started to cause ``` $ cat test.c #include void f(void) { char a[strlen("x")]; (void) a; } ``` ``` $ clang -Wall -fsyntax-only test.c test.c:3:12: warning: variable length array folded to constant array as an extension [-Wgnu-folding-constant] 3 | char

[clang] [clang] Emit bad shift warnings (PR #70307)

2024-07-12 Thread Alan Zhao via cfe-commits
alanzhao1 wrote: > @alanzhao1 do you think it's reasonable for the workaround to only apply to > code in system headers, or does the NDK get included as regular headers > generally? Having it only apply to system headers should be OK - in our case, chrome imports these headers as part of a

[clang] [clang] Emit bad shift warnings (PR #70307)

2024-07-12 Thread Budimir Aranđelović via cfe-commits
budimirarandjelovicsyrmia wrote: > @budimirarandjelovicsyrmia, can you please add a workaround so that the NDK > code can continue to compile? I will investigate this. https://github.com/llvm/llvm-project/pull/70307 ___ cfe-commits mailing list

[clang] [clang] Emit bad shift warnings (PR #70307)

2024-07-12 Thread Aaron Ballman via cfe-commits
AaronBallman wrote: > The android NDK code is wrong, but this no longer compiles (even with > -Wno-error). Well that's unfortunate! Thank you for letting us know. @alanzhao1 do you think it's reasonable for the workaround to only apply to code in system headers, or does the NDK get included

[clang] [clang] Emit bad shift warnings (PR #70307)

2024-07-11 Thread Budimir Aranđelović via cfe-commits
budimirarandjelovicsyrmia wrote: > @budimirarandjelovicsyrmia -- do you need someone to land these changes on > your behalf? I don't understand question. I think that I answered correctly to previous comments. https://github.com/llvm/llvm-project/pull/70307

[clang] [clang] Emit bad shift warnings (PR #70307)

2024-07-11 Thread Aaron Ballman via cfe-commits
AaronBallman wrote: @budimirarandjelovicsyrmia -- do you need someone to land these changes on your behalf? https://github.com/llvm/llvm-project/pull/70307 ___ cfe-commits mailing list cfe-commits@lists.llvm.org

[clang] [clang] Emit bad shift warnings (PR #70307)

2024-07-11 Thread Budimir Aranđelović via cfe-commits
https://github.com/budimirarandjelovicsyrmia updated https://github.com/llvm/llvm-project/pull/70307 From 0dd1a3e2b45a8c918217e62fe844b91dbb51df8e Mon Sep 17 00:00:00 2001 From: budimirarandjelovicsyrmia Date: Thu, 26 Oct 2023 10:39:52 +0200 Subject: [PATCH] [clang] Emit bad shift warnings

[clang] [clang] Emit bad shift warnings (PR #70307)

2024-07-10 Thread Timm Baeder via cfe-commits
https://github.com/tbaederr approved this pull request. https://github.com/llvm/llvm-project/pull/70307 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Emit bad shift warnings (PR #70307)

2024-07-10 Thread Aaron Ballman via cfe-commits
@@ -686,6 +686,8 @@ Improvements to Clang's diagnostics - Clang no longer emits a "no previous prototype" warning for Win32 entry points under ``-Wmissing-prototypes``. Fixes #GH94366. +- Clang now diagnoses non-C++11 integer constant expressions. Fixes #GH59863

[clang] [clang] Emit bad shift warnings (PR #70307)

2024-07-10 Thread Aaron Ballman via cfe-commits
@@ -277,7 +277,9 @@ void dr258(void) { void dr261(void) { /* This is still an integer constant expression despite the overflow. */ AaronBallman wrote: Probably good to update this comment to mention "extension".

[clang] [clang] Emit bad shift warnings (PR #70307)

2024-07-10 Thread Aaron Ballman via cfe-commits
https://github.com/AaronBallman approved this pull request. LGTM aside from a few small things to correct. @tbaederr are you happy with the state of things as well? https://github.com/llvm/llvm-project/pull/70307 ___ cfe-commits mailing list

[clang] [clang] Emit bad shift warnings (PR #70307)

2024-07-10 Thread Aaron Ballman via cfe-commits
https://github.com/AaronBallman edited https://github.com/llvm/llvm-project/pull/70307 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Emit bad shift warnings (PR #70307)

2024-07-10 Thread Budimir Aranđelović via cfe-commits
budimirarandjelovicsyrmia wrote: Ping @AaronBallman @shafik @tbaederr https://github.com/llvm/llvm-project/pull/70307 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Emit bad shift warnings (PR #70307)

2024-07-10 Thread Budimir Aranđelović via cfe-commits
https://github.com/budimirarandjelovicsyrmia updated https://github.com/llvm/llvm-project/pull/70307 From d5f3ea5c5bc3ee94ed72e529482e9df4a8770848 Mon Sep 17 00:00:00 2001 From: budimirarandjelovicsyrmia Date: Thu, 26 Oct 2023 10:39:52 +0200 Subject: [PATCH] [clang] Emit bad shift warnings

[clang] [clang] Emit bad shift warnings (PR #70307)

2024-07-09 Thread Budimir Aranđelović via cfe-commits
https://github.com/budimirarandjelovicsyrmia updated https://github.com/llvm/llvm-project/pull/70307 From 9e4309a805f31096d72cb21cd266175cac5b07c1 Mon Sep 17 00:00:00 2001 From: budimirarandjelovicsyrmia Date: Thu, 26 Oct 2023 10:39:52 +0200 Subject: [PATCH] [clang] Emit bad shift warnings

[clang] [clang] Emit bad shift warnings (PR #70307)

2024-06-27 Thread Budimir Aranđelović via cfe-commits
https://github.com/budimirarandjelovicsyrmia updated https://github.com/llvm/llvm-project/pull/70307 From f8b8175f074c4caba44517ac9ea2714d50c5e86e Mon Sep 17 00:00:00 2001 From: budimirarandjelovicsyrmia Date: Thu, 26 Oct 2023 10:39:52 +0200 Subject: [PATCH] [clang] Emit bad shift warnings

[clang] [clang] Emit bad shift warnings (PR #70307)

2024-06-27 Thread Budimir Aranđelović via cfe-commits
https://github.com/budimirarandjelovicsyrmia updated https://github.com/llvm/llvm-project/pull/70307 From 9e4309a805f31096d72cb21cd266175cac5b07c1 Mon Sep 17 00:00:00 2001 From: budimirarandjelovicsyrmia Date: Thu, 26 Oct 2023 10:39:52 +0200 Subject: [PATCH] [clang] Emit bad shift warnings

[clang] [clang] Emit bad shift warnings (PR #70307)

2024-06-27 Thread Budimir Aranđelović via cfe-commits
https://github.com/budimirarandjelovicsyrmia reopened https://github.com/llvm/llvm-project/pull/70307 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Emit bad shift warnings (PR #70307)

2024-06-27 Thread Budimir Aranđelović via cfe-commits
https://github.com/budimirarandjelovicsyrmia updated https://github.com/llvm/llvm-project/pull/70307 From a66ca21ad79df2385fbaec12344f9c16cc3c5b83 Mon Sep 17 00:00:00 2001 From: budimirarandjelovicsyrmia Date: Thu, 26 Oct 2023 10:39:52 +0200 Subject: [PATCH] [clang] Emit bad shift warnings

[clang] [clang] Emit bad shift warnings (PR #70307)

2024-06-26 Thread Budimir Aranđelović via cfe-commits
https://github.com/budimirarandjelovicsyrmia updated https://github.com/llvm/llvm-project/pull/70307 From 9e4309a805f31096d72cb21cd266175cac5b07c1 Mon Sep 17 00:00:00 2001 From: budimirarandjelovicsyrmia Date: Thu, 26 Oct 2023 10:39:52 +0200 Subject: [PATCH] [clang] Emit bad shift warnings

[clang] [clang] Emit bad shift warnings (PR #70307)

2024-06-25 Thread Budimir Aranđelović via cfe-commits
https://github.com/budimirarandjelovicsyrmia updated https://github.com/llvm/llvm-project/pull/70307 From 39c314b060959578ccfe70c5ef2aa5aba5688c11 Mon Sep 17 00:00:00 2001 From: budimirarandjelovicsyrmia Date: Thu, 26 Oct 2023 10:39:52 +0200 Subject: [PATCH] [clang] Emit bad shift warnings

[clang] [clang] Emit bad shift warnings (PR #70307)

2024-06-25 Thread Budimir Aranđelović via cfe-commits
https://github.com/budimirarandjelovicsyrmia updated https://github.com/llvm/llvm-project/pull/70307 From f19ddd1d381d7e1c79b1d841070deb461f442eb7 Mon Sep 17 00:00:00 2001 From: budimirarandjelovicsyrmia Date: Thu, 26 Oct 2023 10:39:52 +0200 Subject: [PATCH] [clang] Emit bad shift warnings

[clang] [clang] Emit bad shift warnings (PR #70307)

2024-06-25 Thread Budimir Aranđelović via cfe-commits
https://github.com/budimirarandjelovicsyrmia updated https://github.com/llvm/llvm-project/pull/70307 From 975000d3a8bfff223111bc5c119294d6fea929ae Mon Sep 17 00:00:00 2001 From: budimirarandjelovicsyrmia Date: Thu, 26 Oct 2023 10:39:52 +0200 Subject: [PATCH] [clang] Emit bad shift warnings

[clang] [clang] Emit bad shift warnings (PR #70307)

2024-06-24 Thread Budimir Aranđelović via cfe-commits
https://github.com/budimirarandjelovicsyrmia updated https://github.com/llvm/llvm-project/pull/70307 From a80047859d20f0fbb591f6c8a561468ce966f845 Mon Sep 17 00:00:00 2001 From: budimirarandjelovicsyrmia Date: Thu, 26 Oct 2023 10:39:52 +0200 Subject: [PATCH] [clang] Emit bad shift warnings

[clang] [clang] Emit bad shift warnings (PR #70307)

2024-06-24 Thread Budimir Aranđelović via cfe-commits
https://github.com/budimirarandjelovicsyrmia updated https://github.com/llvm/llvm-project/pull/70307 From 6d5fdc817db7216577429e5949bbaa7e6cd3648f Mon Sep 17 00:00:00 2001 From: budimirarandjelovicsyrmia Date: Thu, 26 Oct 2023 10:39:52 +0200 Subject: [PATCH] [clang] Emit bad shift warnings

[clang] [clang] Emit bad shift warnings (PR #70307)

2024-06-24 Thread Budimir Aranđelović via cfe-commits
@@ -430,7 +430,8 @@ void dr081(void) { /* Demonstrate that we don't crash when left shifting a signed value; that's * implementation defined behavior. */ - _Static_assert(-1 << 1 == -2, "fail"); /* Didn't shift a zero into the "sign bit". */ + _Static_assert(-1 << 1

[clang] [clang] Emit bad shift warnings (PR #70307)

2024-06-24 Thread Budimir Aranđelović via cfe-commits
https://github.com/budimirarandjelovicsyrmia updated https://github.com/llvm/llvm-project/pull/70307 From caea9286c405b8dc0e71383efed256beaa5134f0 Mon Sep 17 00:00:00 2001 From: budimirarandjelovicsyrmia Date: Thu, 26 Oct 2023 10:39:52 +0200 Subject: [PATCH] [clang] Emit bad shift warnings

[clang] [clang] Emit bad shift warnings (PR #70307)

2024-06-18 Thread Aaron Ballman via cfe-commits
@@ -277,7 +277,9 @@ void dr258(void) { void dr261(void) { /* This is still an integer constant expression despite the overflow. */ enum e1 { -ex1 = __INT_MAX__ + 1 /* expected-warning {{overflow in expression; result is -2'147'483'648 with type 'int'}} */ +ex1 =

[clang] [clang] Emit bad shift warnings (PR #70307)

2024-06-18 Thread Aaron Ballman via cfe-commits
@@ -430,7 +430,8 @@ void dr081(void) { /* Demonstrate that we don't crash when left shifting a signed value; that's * implementation defined behavior. */ - _Static_assert(-1 << 1 == -2, "fail"); /* Didn't shift a zero into the "sign bit". */ + _Static_assert(-1 << 1

[clang] [clang] Emit bad shift warnings (PR #70307)

2024-06-18 Thread Budimir Aranđelović via cfe-commits
https://github.com/budimirarandjelovicsyrmia updated https://github.com/llvm/llvm-project/pull/70307 From 69c6fc02cef92c0dd0eda0a30daa82856552ef1c Mon Sep 17 00:00:00 2001 From: budimirarandjelovicsyrmia Date: Thu, 26 Oct 2023 10:39:52 +0200 Subject: [PATCH] [clang] Emit bad shift warnings

[clang] [clang] Emit bad shift warnings (PR #70307)

2024-06-17 Thread Budimir Aranđelović via cfe-commits
https://github.com/budimirarandjelovicsyrmia updated https://github.com/llvm/llvm-project/pull/70307 From 0ed347381cdd9e639ab5026dcf244ca4d7fcb6e3 Mon Sep 17 00:00:00 2001 From: budimirarandjelovicsyrmia Date: Thu, 26 Oct 2023 10:39:52 +0200 Subject: [PATCH] [clang] Emit bad shift warnings

[clang] [clang] Emit bad shift warnings (PR #70307)

2024-06-12 Thread Budimir Aranđelović via cfe-commits
@@ -11444,9 +11444,12 @@ static void DiagnoseBadShiftValues(Sema& S, ExprResult , ExprResult , llvm::APSInt Right = RHSResult.Val.getInt(); if (Right.isNegative()) { -S.DiagRuntimeBehavior(Loc, RHS.get(), - S.PDiag(diag::warn_shift_negative)

[clang] [clang] Emit bad shift warnings (PR #70307)

2024-06-12 Thread Budimir Aranđelović via cfe-commits
https://github.com/budimirarandjelovicsyrmia updated https://github.com/llvm/llvm-project/pull/70307 From 550bdebeb5ee3e305495407063a7d33c640a333c Mon Sep 17 00:00:00 2001 From: budimirarandjelovicsyrmia Date: Thu, 26 Oct 2023 10:39:52 +0200 Subject: [PATCH] [clang] Emit bad shift warnings

[clang] [clang] Emit bad shift warnings (PR #70307)

2024-04-09 Thread Timm Baeder via cfe-commits
@@ -11444,9 +11444,12 @@ static void DiagnoseBadShiftValues(Sema& S, ExprResult , ExprResult , llvm::APSInt Right = RHSResult.Val.getInt(); if (Right.isNegative()) { -S.DiagRuntimeBehavior(Loc, RHS.get(), - S.PDiag(diag::warn_shift_negative)

[clang] [clang] Emit bad shift warnings (PR #70307)

2024-03-26 Thread Aaron Ballman via cfe-commits
@@ -11444,9 +11444,12 @@ static void DiagnoseBadShiftValues(Sema& S, ExprResult , ExprResult , llvm::APSInt Right = RHSResult.Val.getInt(); if (Right.isNegative()) { -S.DiagRuntimeBehavior(Loc, RHS.get(), - S.PDiag(diag::warn_shift_negative)

[clang] [clang] Emit bad shift warnings (PR #70307)

2024-03-26 Thread Aaron Ballman via cfe-commits
@@ -2805,7 +2805,7 @@ static bool handleIntIntBinOp(EvalInfo , const Expr *E, const APSInt , unsigned SA = (unsigned) RHS.getLimitedValue(LHS.getBitWidth()-1); if (SA != RHS) { Info.CCEDiag(E, diag::note_constexpr_large_shift) -<< RHS << E->getType() <<

[clang] [clang] Emit bad shift warnings (PR #70307)

2024-03-26 Thread Budimir Aranđelović via cfe-commits
@@ -2805,7 +2805,7 @@ static bool handleIntIntBinOp(EvalInfo , const Expr *E, const APSInt , unsigned SA = (unsigned) RHS.getLimitedValue(LHS.getBitWidth()-1); if (SA != RHS) { Info.CCEDiag(E, diag::note_constexpr_large_shift) -<< RHS << E->getType() <<

[clang] [clang] Emit bad shift warnings (PR #70307)

2024-03-26 Thread Budimir Aranđelović via cfe-commits
https://github.com/budimirarandjelovicsyrmia updated https://github.com/llvm/llvm-project/pull/70307 From 17fb77d094018db20de0ac2a65861338006f9d68 Mon Sep 17 00:00:00 2001 From: budimirarandjelovicsyrmia Date: Thu, 26 Oct 2023 10:39:52 +0200 Subject: [PATCH] [clang] Emit bad shift warnings

[clang] [clang] Emit bad shift warnings (PR #70307)

2024-03-25 Thread Aaron Ballman via cfe-commits
@@ -11428,7 +11428,7 @@ static bool isScopedEnumerationType(QualType T) { return false; } -static void DiagnoseBadShiftValues(Sema& S, ExprResult , ExprResult , +static void DiagnoseBadShiftValues(Sema , ExprResult , ExprResult , AaronBallman wrote:

[clang] [clang] Emit bad shift warnings (PR #70307)

2024-03-25 Thread Aaron Ballman via cfe-commits
@@ -2805,7 +2805,7 @@ static bool handleIntIntBinOp(EvalInfo , const Expr *E, const APSInt , unsigned SA = (unsigned) RHS.getLimitedValue(LHS.getBitWidth()-1); if (SA != RHS) { Info.CCEDiag(E, diag::note_constexpr_large_shift) -<< RHS << E->getType() <<

[clang] [clang] Emit bad shift warnings (PR #70307)

2024-03-25 Thread Aaron Ballman via cfe-commits
https://github.com/AaronBallman edited https://github.com/llvm/llvm-project/pull/70307 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Emit bad shift warnings (PR #70307)

2024-03-25 Thread Aaron Ballman via cfe-commits
@@ -11523,9 +11525,9 @@ static void DiagnoseBadShiftValues(Sema& S, ExprResult , ExprResult , } S.Diag(Loc, diag::warn_shift_result_gt_typewidth) -<< HexResult.str() << Result.getMinSignedBits() << LHSType -<< Left.getBitWidth() << LHS.get()->getSourceRange() -

[clang] [clang] Emit bad shift warnings (PR #70307)

2024-03-25 Thread Aaron Ballman via cfe-commits
@@ -19959,7 +19961,10 @@ bool Sema::DiagRuntimeBehavior(SourceLocation Loc, ArrayRef Stmts, case ExpressionEvaluationContext::ConstantEvaluated: case ExpressionEvaluationContext::ImmediateFunctionContext: // Relevant diagnostics should be produced by constant

[clang] [clang] Emit bad shift warnings (PR #70307)

2024-03-25 Thread Aaron Ballman via cfe-commits
https://github.com/AaronBallman requested changes to this pull request. https://github.com/llvm/llvm-project/pull/70307 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Emit bad shift warnings (PR #70307)

2024-03-20 Thread Budimir Aranđelović via cfe-commits
@@ -2836,9 +2837,11 @@ static bool handleIntIntBinOp(EvalInfo , const Expr *E, const APSInt , // C++11 [expr.shift]p1: Shift width must be less than the bit width of the // shifted type. unsigned SA = (unsigned) RHS.getLimitedValue(LHS.getBitWidth()-1); -if

[clang] [clang] Emit bad shift warnings (PR #70307)

2024-03-20 Thread Budimir Aranđelović via cfe-commits
@@ -2803,9 +2803,10 @@ static bool handleIntIntBinOp(EvalInfo , const Expr *E, const APSInt , // C++11 [expr.shift]p1: Shift width must be less than the bit width of // the shifted type. unsigned SA = (unsigned) RHS.getLimitedValue(LHS.getBitWidth()-1); -if

[clang] [clang] Emit bad shift warnings (PR #70307)

2024-03-20 Thread Budimir Aranđelović via cfe-commits
https://github.com/budimirarandjelovicsyrmia updated https://github.com/llvm/llvm-project/pull/70307 From c9ef2f27f4b633a5862c4a46d6940ce830a7bde1 Mon Sep 17 00:00:00 2001 From: budimirarandjelovicsyrmia Date: Thu, 26 Oct 2023 10:39:52 +0200 Subject: [PATCH] [clang] Emit bad shift warnings

[clang] [clang] Emit bad shift warnings (PR #70307)

2024-03-12 Thread Timm Baeder via cfe-commits
tbaederr wrote: There are two questions above about removing a diagnostic that you haven't answered yet https://github.com/llvm/llvm-project/pull/70307 ___ cfe-commits mailing list cfe-commits@lists.llvm.org

[clang] [clang] Emit bad shift warnings (PR #70307)

2024-03-12 Thread Budimir Aranđelović via cfe-commits
budimirarandjelovicsyrmia wrote: Ping @AaronBallman https://github.com/llvm/llvm-project/pull/70307 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Emit bad shift warnings (PR #70307)

2024-01-23 Thread Budimir Aranđelović via cfe-commits
https://github.com/budimirarandjelovicsyrmia updated https://github.com/llvm/llvm-project/pull/70307 From c89be5f77740d0800339cca189312800f567ffb9 Mon Sep 17 00:00:00 2001 From: budimirarandjelovicsyrmia Date: Thu, 26 Oct 2023 10:39:52 +0200 Subject: [PATCH] [clang] Emit bad shift warnings

[clang] [clang] Emit bad shift warnings (PR #70307)

2024-01-23 Thread Budimir Aranđelović via cfe-commits
budimirarandjelovicsyrmia wrote: > The patch summary doesn't really explain why the changes are needed. Can you > explain what problem you're solving (perhaps link to an issue if this is > fixing one that was reported by someone)? Main goal of this patch is to enable diagnosing and emitting

[clang] [clang] Emit bad shift warnings (PR #70307)

2024-01-11 Thread Aaron Ballman via cfe-commits
@@ -426,7 +426,7 @@ void dr081(void) { /* Demonstrate that we don't crash when left shifting a signed value; that's * implementation defined behavior. */ - _Static_assert(-1 << 1 == -2, "fail"); /* Didn't shift a zero into the "sign bit". */ + _Static_assert(-1 << 1

[clang] [clang] Emit bad shift warnings (PR #70307)

2024-01-11 Thread Aaron Ballman via cfe-commits
@@ -2836,9 +2837,11 @@ static bool handleIntIntBinOp(EvalInfo , const Expr *E, const APSInt , // C++11 [expr.shift]p1: Shift width must be less than the bit width of the // shifted type. unsigned SA = (unsigned) RHS.getLimitedValue(LHS.getBitWidth()-1); -if

[clang] [clang] Emit bad shift warnings (PR #70307)

2024-01-11 Thread Aaron Ballman via cfe-commits
@@ -0,0 +1,8 @@ +// RUN: %clang_cc1 -x c -fsyntax-only -verify -Wshift-negative-value %s +// RUN: %clang_cc1 -x c -fsyntax-only -verify -Wall %s +// RUN: %clang_cc1 -x c++ -fsyntax-only -verify -Wshift-negative-value %s +// RUN: %clang_cc1 -x c++ -fsyntax-only -verify -Wall %s +

[clang] [clang] Emit bad shift warnings (PR #70307)

2024-01-11 Thread Aaron Ballman via cfe-commits
https://github.com/AaronBallman commented: The patch summary doesn't really explain why the changes are needed. Can you explain what problem you're solving (perhaps link to an issue if this is fixing one that was reported by someone)? https://github.com/llvm/llvm-project/pull/70307

[clang] [clang] Emit bad shift warnings (PR #70307)

2024-01-11 Thread Aaron Ballman via cfe-commits
@@ -2803,9 +2803,10 @@ static bool handleIntIntBinOp(EvalInfo , const Expr *E, const APSInt , // C++11 [expr.shift]p1: Shift width must be less than the bit width of // the shifted type. unsigned SA = (unsigned) RHS.getLimitedValue(LHS.getBitWidth()-1); -if

[clang] [clang] Emit bad shift warnings (PR #70307)

2024-01-11 Thread Aaron Ballman via cfe-commits
@@ -0,0 +1,8 @@ +// RUN: %clang_cc1 -x c -fsyntax-only -verify -Wshift-count-negative %s +// RUN: %clang_cc1 -x c -fsyntax-only -verify -Wall %s +// RUN: %clang_cc1 -x c++ -fsyntax-only -verify -Wshift-count-negative %s +// RUN: %clang_cc1 -x c++ -fsyntax-only -verify -Wall %s +

[clang] [clang] Emit bad shift warnings (PR #70307)

2024-01-11 Thread Aaron Ballman via cfe-commits
https://github.com/AaronBallman edited https://github.com/llvm/llvm-project/pull/70307 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Emit bad shift warnings (PR #70307)

2023-11-17 Thread Budimir Aranđelović via cfe-commits
https://github.com/budimirarandjelovicsyrmia updated https://github.com/llvm/llvm-project/pull/70307 From c9b85c8e435790d8b4a42340f3963d852e7d65ae Mon Sep 17 00:00:00 2001 From: budimirarandjelovicsyrmia Date: Thu, 26 Oct 2023 10:39:52 +0200 Subject: [PATCH] [clang] Emit bad shift warnings

[clang] [clang] Emit bad shift warnings (PR #70307)

2023-11-03 Thread Budimir Aranđelović via cfe-commits
@@ -11773,7 +11786,25 @@ QualType Sema::CheckShiftOperands(ExprResult , ExprResult , isScopedEnumerationType(RHSType)) { return InvalidOperands(Loc, LHS, RHS); } - DiagnoseBadShiftValues(*this, LHS, RHS, Loc, Opc, LHSType); + + BadShiftValueKind BSVKind = +

[clang] [clang] Emit bad shift warnings (PR #70307)

2023-10-27 Thread Shafik Yaghmour via cfe-commits
@@ -11773,7 +11786,25 @@ QualType Sema::CheckShiftOperands(ExprResult , ExprResult , isScopedEnumerationType(RHSType)) { return InvalidOperands(Loc, LHS, RHS); } - DiagnoseBadShiftValues(*this, LHS, RHS, Loc, Opc, LHSType); + + BadShiftValueKind BSVKind = +

[clang] [clang] Emit bad shift warnings (PR #70307)

2023-10-26 Thread Budimir Aranđelović via cfe-commits
https://github.com/budimirarandjelovicsyrmia created https://github.com/llvm/llvm-project/pull/70307 Diagnose bad shifts and emit warnings From 894d6503b0e1ced73bab65b0454abfc65d5b8a99 Mon Sep 17 00:00:00 2001 From: budimirarandjelovicsyrmia Date: Thu, 26 Oct 2023 10:39:52 +0200 Subject: