History log of /llvm-project/clang/test/Analysis/builtin_overflow.c (Results 1 – 2 of 2)
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
Revision tags: llvmorg-21-init, llvmorg-19.1.7, llvmorg-19.1.6, llvmorg-19.1.5, llvmorg-19.1.4, llvmorg-19.1.3, llvmorg-19.1.2
# fba6c887 05-Oct-2024 Pavel Skripkin <paskripkin@gmail.com>

[analyzer] Fix wrong `builtin_*_overflow` return type (#111253)

`builtin_*_overflow` functions return `_Bool` according to [1].
`BuiltinFunctionChecker` was using `makeTruthVal` w/o specifying
expli

[analyzer] Fix wrong `builtin_*_overflow` return type (#111253)

`builtin_*_overflow` functions return `_Bool` according to [1].
`BuiltinFunctionChecker` was using `makeTruthVal` w/o specifying
explicit type, which creates an `int` value, since it's the type of any
compassion according to C standard.

Fix it by directly passing `BoolTy` to `makeTruthVal`

Closes: #111147

[1]
https://clang.llvm.org/docs/LanguageExtensions.html#checked-arithmetic-builtins

show more ...


# a017ed04 03-Oct-2024 Pavel Skripkin <paskripkin@gmail.com>

[analyzer] Model overflow builtins (#102602)

Add basic support for `builtin_*_overflow` primitives.

These helps a lot for checking custom calloc-like functions with
inlinable body. Without such s

[analyzer] Model overflow builtins (#102602)

Add basic support for `builtin_*_overflow` primitives.

These helps a lot for checking custom calloc-like functions with
inlinable body. Without such support code like

```c
#include <stddef.h>
#include <stdlib.h>

static void *myMalloc(size_t a1, size_t a2)
{
size_t res;

if (__builtin_mul_overflow(a1, a2, &res))
return NULL;
return malloc(res);
}

void test(void)
{
char *ptr = myMalloc(10, 1);
ptr[20] = 10;
}
````

does not trigger any warnings.

show more ...