Zonotora wrote:
@zygoloid I don't have write access, please merge on my behalf!
https://github.com/llvm/llvm-project/pull/114865
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/Zonotora updated
https://github.com/llvm/llvm-project/pull/114865
>From 56302037f6e70989f92069de986f117e530c78d5 Mon Sep 17 00:00:00 2001
From: Zonotora
Date: Mon, 4 Nov 2024 16:40:59 +0100
Subject: [PATCH] [clang][UBSan] Make sure that the implicit-conversion group
is compa
Zonotora wrote:
Will do
https://github.com/llvm/llvm-project/pull/114865
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Zonotora wrote:
@vitalybuka This is connected to
https://github.com/llvm/llvm-project/pull/75481 that was merged a couple of
months ago..
https://github.com/llvm/llvm-project/pull/114865
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https:/
Zonotora wrote:
Hi @zygoloid and @efriedma-quic, would you mind taking a look? Thanks!
https://github.com/llvm/llvm-project/pull/114865
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Zonotora wrote:
@vitalybuka
https://github.com/llvm/llvm-project/pull/114865
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/Zonotora created
https://github.com/llvm/llvm-project/pull/114865
We are currently getting:
`clang: error: invalid argument '-fsanitize-minimal-runtime' not allowed with
'-fsanitize=implicit-conversion'`
when running
`-fsanitize=implicit-conversion -fsanitize-minimal-runti
@@ -0,0 +1,94 @@
+// RUN: %clang -x c++ -fsanitize=implicit-bitfield-conversion -target
x86_64-linux -S -emit-llvm -o - %s | FileCheck %s
--check-prefixes=CHECK,CHECK-BITFIELD-CONVERSION
+// RUN: %clang -x c++ -fsanitize=implicit-integer-conversion -target
x86_64-linux -S -emit
Zonotora wrote:
@vitalybuka Well, this is awkward, fails due to:
https://lab.llvm.org/buildbot/#/builders/127/builds/64260
C:\b\slave\sanitizer-windows\llvm-project\compiler-rt\test\ubsan\TestCases\ImplicitConversion\bitfield-conversion.c:36:3:
error: unknown type name '_Bool'
Some other test
Zonotora wrote:
@vitalybuka all green?
https://github.com/llvm/llvm-project/pull/87761
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Zonotora wrote:
@vitalybuka yes, seems like all testcases failed due to not explicitly setting
BitfieldBits to 0 except one,
LeakSanitizer-AddressSanitizer-i386 :: TestCases/leak_check_at_exit.cpp
not really sure what the problem is. Also added another testcase
`ubsan/TestCases/ImplicitConve
https://github.com/Zonotora edited
https://github.com/llvm/llvm-project/pull/87761
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/Zonotora updated
https://github.com/llvm/llvm-project/pull/87761
>From a2a1ba32654f6b4a6b3d85e7a8733c9f8bd1b5f7 Mon Sep 17 00:00:00 2001
From: Zonotora
Date: Thu, 4 Apr 2024 20:27:14 +0200
Subject: [PATCH] Fix "[clang][UBSan] Add implicit conversion check for
bitfields"
---
https://github.com/Zonotora created
https://github.com/llvm/llvm-project/pull/87761
Fix since #75481 got reverted.
- Explicitly set BitfieldBits to 0 to avoid uninitialized field member for the
integer checks:
```diff
- llvm::ConstantInt::get(Builder.getInt8Ty(), Check.first)};
+ ll
Zonotora wrote:
> Also, I don't have commit access (first PR here), someone has to commit on my
> behalf!
@AaronBallman
https://github.com/llvm/llvm-project/pull/75481
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cg
Zonotora wrote:
Also, I don't have commit access (first PR here), someone has to commit on my
behalf!
https://github.com/llvm/llvm-project/pull/75481
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listin
https://github.com/Zonotora updated
https://github.com/llvm/llvm-project/pull/75481
>From 42207b6369b22db7e8400f290be8c6ee75a5278a Mon Sep 17 00:00:00 2001
From: Zonotora
Date: Sat, 16 Dec 2023 19:33:21 +0100
Subject: [PATCH 1/3] [clang] Extract negativity check lambda to function
---
clang/l
Zonotora wrote:
@LebedevRI LGTM?
https://github.com/llvm/llvm-project/pull/75481
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -0,0 +1,61 @@
+// RUN: %clang -fsanitize=implicit-bitfield-conversion -target x86_64-linux -S
-emit-llvm -o - %s | FileCheck %s
--check-prefixes=CHECK,CHECK-BITFIELD-CONVERSION
Zonotora wrote:
Added!
https://github.com/llvm/llvm-project/pull/75481
_
https://github.com/Zonotora updated
https://github.com/llvm/llvm-project/pull/75481
>From 3213a5d3c8230cc941d026475624b754bc87a41e Mon Sep 17 00:00:00 2001
From: Zonotora
Date: Sat, 16 Dec 2023 19:33:21 +0100
Subject: [PATCH 1/3] [clang] Extract negativity check lambda to function
---
clang/l
@@ -147,6 +147,7 @@ struct ImplicitConversionData {
const TypeDescriptor &FromType;
const TypeDescriptor &ToType;
/* ImplicitConversionCheckKind */ unsigned char Kind;
+ unsigned int BitfieldBits;
Zonotora wrote:
@zygoloid
https://github.com/llvm/llvm
@@ -0,0 +1,61 @@
+// RUN: %clang -fsanitize=implicit-bitfield-conversion -target x86_64-linux -S
-emit-llvm -o - %s | FileCheck %s
--check-prefixes=CHECK,CHECK-BITFIELD-CONVERSION
Zonotora wrote:
I will add some testcases later today!
https://github.com/llvm/l
https://github.com/Zonotora updated
https://github.com/llvm/llvm-project/pull/75481
>From f0f02479736548a72c8a35ca3fea067b02e66bfd Mon Sep 17 00:00:00 2001
From: Zonotora
Date: Sat, 16 Dec 2023 19:33:21 +0100
Subject: [PATCH 1/3] [clang] Extract negativity check lambda to function
---
clang/l
https://github.com/Zonotora updated
https://github.com/llvm/llvm-project/pull/75481
>From cd64144a4cf18adba1494871bfd9da1b0bf0a489 Mon Sep 17 00:00:00 2001
From: Zonotora
Date: Sat, 16 Dec 2023 19:33:21 +0100
Subject: [PATCH 1/3] [clang] Extract negativity check lambda to function
---
clang/l
@@ -5571,11 +5571,52 @@ LValue CodeGenFunction::EmitBinaryOperatorLValue(const
BinaryOperator *E) {
break;
}
-RValue RV = EmitAnyExpr(E->getRHS());
+llvm::Value *Previous = nullptr;
+RValue RV;
+QualType SrcType = E->getRHS()->getType();
+// Chec
@@ -5571,11 +5571,52 @@ LValue CodeGenFunction::EmitBinaryOperatorLValue(const
BinaryOperator *E) {
break;
}
-RValue RV = EmitAnyExpr(E->getRHS());
+llvm::Value *Previous = nullptr;
Zonotora wrote:
I would also like to have it work similar
Zonotora wrote:
@zygoloid Thanks for your feedback! Fixed all comments except the last one. I
totally agree with you about the distinction of UB checks, and that should be
part of a different future PR!
https://github.com/llvm/llvm-project/pull/75481
__
@@ -555,13 +555,11 @@ static void
handleImplicitConversion(ImplicitConversionData *Data,
ReportOptions Opts, ValueHandle Src,
ValueHandle Dst) {
SourceLocation Loc = Data->Loc.acquire();
- ErrorType E
https://github.com/Zonotora updated
https://github.com/llvm/llvm-project/pull/75481
>From cd64144a4cf18adba1494871bfd9da1b0bf0a489 Mon Sep 17 00:00:00 2001
From: Zonotora
Date: Sat, 16 Dec 2023 19:33:21 +0100
Subject: [PATCH 1/3] [clang] Extract negativity check lambda to function
---
clang/l
Zonotora wrote:
@zygoloid @AaronBallman any updates?
https://github.com/llvm/llvm-project/pull/75481
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Zonotora wrote:
> Precommit CI seems to have found some related failures that should be
> investigated. I'd love to hear opinions from the codegen code owners on this,
> as well as @zygoloid as UBSan code owner. I'm not opposed to the changes,
> though I do find it somewhat strange to add them
Zonotora wrote:
@zygoloid what do you think?
https://github.com/llvm/llvm-project/pull/75481
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/Zonotora updated
https://github.com/llvm/llvm-project/pull/75481
>From a3de13f8356cd615534c759b6e24893d361e62e9 Mon Sep 17 00:00:00 2001
From: Zonotora
Date: Sat, 16 Dec 2023 19:33:21 +0100
Subject: [PATCH 1/3] [clang] Extract negativity check lambda to function
---
clang/l
Zonotora wrote:
@rjmccall fixed feedback
> You should handle compound assignments.
I believe I already support compound assignments (and PrePostIncDec), if I am
not missing something? :smiley:
https://github.com/llvm/llvm-project/pull/75481
___
cf
https://github.com/Zonotora updated
https://github.com/llvm/llvm-project/pull/75481
>From 5c85a13cbd5fb1d861f2b5a4cbb53abc5736674e Mon Sep 17 00:00:00 2001
From: Zonotora
Date: Sat, 16 Dec 2023 19:33:21 +0100
Subject: [PATCH 1/3] [clang] Extract negativity check lambda to function
---
clang/l
https://github.com/Zonotora updated
https://github.com/llvm/llvm-project/pull/75481
>From 5c85a13cbd5fb1d861f2b5a4cbb53abc5736674e Mon Sep 17 00:00:00 2001
From: Zonotora
Date: Sat, 16 Dec 2023 19:33:21 +0100
Subject: [PATCH 1/3] [clang] Extract negativity check lambda to function
---
clang/l
@@ -324,6 +326,19 @@ class ScalarExprEmitter
void EmitIntegerSignChangeCheck(Value *Src, QualType SrcType, Value *Dst,
QualType DstType, SourceLocation Loc);
+ /// Emit a check that an [implicit] truncation of a bitfield does not
+ /// dis
@@ -1035,7 +1050,7 @@ EmitIntegerTruncationCheckHelper(Value *Src, QualType
SrcType, Value *Dst,
}
llvm::Value *Check = nullptr;
- // 1. Extend the truncated value back to the same width as the Src.
+ // 1. Convert the Dst back to the same type as Src.
@@ -1097,6 +1112,27 @@ void ScalarExprEmitter::EmitIntegerTruncationCheck(Value
*Src, QualType SrcType,
{Src, Dst});
}
+static llvm::Value *EmitIsNegativeTestHelper(Value *V, QualType VType,
+ const char *Name,
+
@@ -1097,6 +1112,27 @@ void ScalarExprEmitter::EmitIntegerTruncationCheck(Value
*Src, QualType SrcType,
{Src, Dst});
}
+static llvm::Value *EmitIsNegativeTestHelper(Value *V, QualType VType,
+ const char *Name,
+
@@ -5570,11 +5570,44 @@ LValue CodeGenFunction::EmitBinaryOperatorLValue(const
BinaryOperator *E) {
break;
}
-RValue RV = EmitAnyExpr(E->getRHS());
+llvm::Value *Previous = nullptr;
+RValue RV;
+QualType SrcType = E->getRHS()->getType();
+// If L
@@ -122,6 +122,26 @@ Non-comprehensive list of changes in this release
New Compiler Flags
--
+- ``-fsanitize=implicit-unsigned-bitfield-truncation`` catches implicit
+ unsigned conversions involving bitfields.
+- ``-fsanitize=implicit-signed-bitfield-truncatio
https://github.com/Zonotora updated
https://github.com/llvm/llvm-project/pull/75481
>From b23f9855820196f7ee5741d81f7c408a641a96fd Mon Sep 17 00:00:00 2001
From: Zonotora
Date: Sat, 16 Dec 2023 19:33:21 +0100
Subject: [PATCH 1/3] [clang] Extract negativity check lambda to function
---
clang/l
Zonotora wrote:
Hi again, I have now finally gotten time and updated the patch so that the
unnecessary emits I mentioned in the initial commit are avoided. The current
patch introduces a number of new fsanitizer flags to separate integer
conversions from bitfield conversions. E.g.,
- ``-fsan
https://github.com/Zonotora edited
https://github.com/llvm/llvm-project/pull/75481
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/Zonotora updated
https://github.com/llvm/llvm-project/pull/75481
>From 3b0af99a0e13ed9d6b8c0365a9fa7ea68ec5 Mon Sep 17 00:00:00 2001
From: Zonotora
Date: Sat, 16 Dec 2023 19:33:21 +0100
Subject: [PATCH 1/2] [clang] Extract negativity check lambda to function
---
clang/l
Zonotora wrote:
> Please add test coverage for compound assignment and increment/decrement.
>
> This seems like a reasonable extension of the existing integer truncation
> checks, but we might want to consider giving it a unique name. Otherwise,
> people using integer truncation checks will ha
Zonotora wrote:
Feedback @vitalybuka @AaronBallman @LebedevRI? :smiley:
https://github.com/llvm/llvm-project/pull/75481
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Zonotora wrote:
> Is is UB?
Don't think so? To quote [1]:
> Issues caught by these sanitizers are not undefined behavior, but are often
> unintentional.
where "these sanitizers" refer to `implicit-unsigned-integer-truncation`,
`implicit-signed-integer-truncation` and `implicit-integer-sign-ch
@@ -1094,6 +1114,27 @@ void ScalarExprEmitter::EmitIntegerTruncationCheck(Value
*Src, QualType SrcType,
{Src, Dst});
}
+static llvm::Value *EmitIsNegativeTestHelper(Value *V, QualType VType,
Zonotora wrote:
fixed
https://github.com/llvm/llvm
https://github.com/Zonotora updated
https://github.com/llvm/llvm-project/pull/75481
>From 8b76571cb7412f3520abf7df5c56cfc987ab7b6e Mon Sep 17 00:00:00 2001
From: Zonotora
Date: Sat, 16 Dec 2023 19:33:21 +0100
Subject: [PATCH 1/2] [clang] Extract negativity check lambda to function
---
clang/l
Zonotora wrote:
Hi, @vitalybuka @zygoloid @AaronBallman you might have something to say about
this commit
https://github.com/llvm/llvm-project/pull/75481
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/li
https://github.com/Zonotora created
https://github.com/llvm/llvm-project/pull/75481
This patch implements the implicit truncation and implicit sign change checks
for bitfields using UBSan. E.g.,
`-fsanitize=implicit-integer-truncation` and
`-fsanitize=implicit-integer-sign-change`.
However, r
53 matches
Mail list logo