zygoloid wrote:
> But still I feel generate a warning for this case went too far.
Yeah, that's probably right. Maybe for `-` on a signed operand, we should just
return the original range with the `NonNegative` flag cleared out, and
shouldn't add the extra bit for the `-128 -> 128` edge case. T
zygoloid wrote:
> > But still I feel generate a warning for this case went too far.
>
> Yeah, that's probably right. Maybe for `-` on a signed operand, we should
> just return the original range with the `NonNegative` flag cleared out, and
> shouldn't add the extra bit for the `-128 -> 128` ed
zygoloid wrote:
> Would it be possible to provide better fine grained control over the
> `-Wsign-compare` so the clang could still flag the the cases like the one in
> the summary but ignore the cases where implicit conversion has no side
> effects or UB?
The warning being produced is a `-Wim
YutongZhuu wrote:
> I think this change might went too far. We are seeing this check flagging
> code like this:
>
> ```
> error: implicit conversion loses integer precision: 'int' to 'int8_t' (aka
> 'signed char') [-Werror,-Wimplicit-int-conversion]:
> int8_t shift = ...
> ...
> shift = -shift
erichkeane wrote:
> > This had the side effect of adding implicit-int-conversion warnings on e.g.
> > the following code:
> > ```
> > unsigned char foo(unsigned char x)
> > {
> > return ~x;
> > }
> > ```
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
YutongZhuu wrote:
> This had the side effect of adding implicit-int-conversion warnings on e.g.
> the following code:
>
> ```
> unsigned char foo(unsigned char x)
> {
> return ~x;
> }
> ```
>
> This seems correct, but this should probably be highlighted in the release
> notes.
>
> Anothe
jplehr wrote:
> Hi, I think this broke two of our buildbots -- for reasons I don't quite
> understand, but reverting fixed the issue locally. Can you please take a look
> at it?
>
> https://lab.llvm.org/buildbot/#/builders/10/builds/980
> https://lab.llvm.org/buildbot/#/builders/73/builds/143
glandium wrote:
This had the side effect of adding implicit-int-conversion warnings on e.g. the
following code:
```
unsigned char foo(unsigned char x)
{
return ~x;
}
```
This seems correct, but this should probably be highlighted in the release
notes.
Another example is:
```
unsigned int f
jplehr wrote:
Hi, I think this broke two of our buildbots -- for reasons I don't quite
understand, but reverting fixed the issue locally.
Can you please take a look at it?
https://lab.llvm.org/buildbot/#/builders/10/builds/980
https://lab.llvm.org/buildbot/#/builders/73/builds/14304
https://gi
https://github.com/cor3ntin closed
https://github.com/llvm/llvm-project/pull/126846
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/YutongZhuu edited
https://github.com/llvm/llvm-project/pull/126846
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/YutongZhuu edited
https://github.com/llvm/llvm-project/pull/126846
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
YutongZhuu wrote:
> Can you update the first comment on this PR to reflect what you want to be in
> the commit message? I notice that it doesn't describe what you're doing with
> negation yet. Thanks!
Hello, can you merge this or delete the review request I sent? This was due to
an unsuccessf
YutongZhuu wrote:
> Can you update the first comment on this PR to reflect what you want to be in
> the commit message? I notice that it doesn't describe what you're doing with
> negation yet. Thanks!
Addressed
https://github.com/llvm/llvm-project/pull/126846
_
https://github.com/YutongZhuu updated
https://github.com/llvm/llvm-project/pull/126846
>From 106a982e3c6bcfa3ee7c26133f0919791699f31a Mon Sep 17 00:00:00 2001
From: Yutong Zhu
Date: Sun, 23 Feb 2025 18:16:06 -0500
Subject: [PATCH 1/5] Fix signed-unsigned comparison with UO_Not and UO_Minus
---
https://github.com/YutongZhuu updated
https://github.com/llvm/llvm-project/pull/126846
>From 331ff18c3c3c3a16b7833e6c5299dc40cfacf694 Mon Sep 17 00:00:00 2001
From: Yutong Zhu
Date: Sun, 23 Feb 2025 18:16:06 -0500
Subject: [PATCH] Fix signed-unsigned integer comparison diagnosis that
contains
https://github.com/YutongZhuu updated
https://github.com/llvm/llvm-project/pull/126846
>From d7404029e8998c8c8945cfaa34cf99b743ec2b70 Mon Sep 17 00:00:00 2001
From: Yutong Zhu
Date: Sun, 23 Feb 2025 18:16:06 -0500
Subject: [PATCH 1/4] Fix no warning for comparison of integers of different
sign
zygoloid wrote:
Can you update the first comment on this PR to reflect what you want to be in
the commit message? I notice that it doesn't describe what you're doing with
negation yet. Thanks!
https://github.com/llvm/llvm-project/pull/126846
___
cfe-
YutongZhuu wrote:
> @YutongZhuu Will you need someone to merge this for you?
I think so. I don't think I have the permission to merge.
https://github.com/llvm/llvm-project/pull/126846
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lis
https://github.com/zygoloid approved this pull request.
https://github.com/llvm/llvm-project/pull/126846
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
YutongZhuu wrote:
Sorry, I accidentally requested for a review. Did not mean it.
https://github.com/llvm/llvm-project/pull/126846
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
cor3ntin wrote:
@YutongZhuu Will you need someone to merge this for you?
https://github.com/llvm/llvm-project/pull/126846
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/YutongZhuu updated
https://github.com/llvm/llvm-project/pull/126846
>From d7404029e8998c8c8945cfaa34cf99b743ec2b70 Mon Sep 17 00:00:00 2001
From: Yutong Zhu
Date: Sun, 23 Feb 2025 18:16:06 -0500
Subject: [PATCH 1/2] Fix no warning for comparison of integers of different
sign
https://github.com/YutongZhuu updated
https://github.com/llvm/llvm-project/pull/126846
>From d7404029e8998c8c8945cfaa34cf99b743ec2b70 Mon Sep 17 00:00:00 2001
From: Yutong Zhu
Date: Sun, 23 Feb 2025 18:16:06 -0500
Subject: [PATCH] Fix no warning for comparison of integers of different signs
--
@@ -10069,6 +10069,17 @@ static std::optional
TryGetExprRange(ASTContext &C, const Expr *E,
case UO_AddrOf: // should be impossible
return IntRange::forValueOfType(C, GetExprType(E));
+case UO_Not: {
+ std::optional SubRange = TryGetExprRange(
+ C,
https://github.com/YutongZhuu updated
https://github.com/llvm/llvm-project/pull/126846
>From d7404029e8998c8c8945cfaa34cf99b743ec2b70 Mon Sep 17 00:00:00 2001
From: Yutong Zhu
Date: Sun, 23 Feb 2025 18:16:06 -0500
Subject: [PATCH] Fix no warning for comparison of integers of different signs
--
@@ -10069,6 +10069,17 @@ static std::optional
TryGetExprRange(ASTContext &C, const Expr *E,
case UO_AddrOf: // should be impossible
return IntRange::forValueOfType(C, GetExprType(E));
+case UO_Not: {
+ std::optional SubRange = TryGetExprRange(
+ C,
https://github.com/YutongZhuu updated
https://github.com/llvm/llvm-project/pull/126846
>From 44673ebf7c3fa773ffc7c52141b889c9ea352a93 Mon Sep 17 00:00:00 2001
From: Yutong Zhu
Date: Tue, 11 Feb 2025 22:49:40 -0500
Subject: [PATCH] Force expressions with UO_Not to not be non-negative
---
clang
28 matches
Mail list logo