[all-commits] [llvm/llvm-project] b2c3ae: [Sema] Don't check bounds for function pointer
Aleksandr Platonov via All-commits
all-commits at lists.llvm.org
Wed Apr 13 10:43:29 PDT 2022
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: b2c3ae0b6f05fd0c2184aea82637685a13b8dc4f
https://github.com/llvm/llvm-project/commit/b2c3ae0b6f05fd0c2184aea82637685a13b8dc4f
Author: Aleksandr Platonov <platonov.aleksandr at huawei.com>
Date: 2022-04-13 (Wed, 13 Apr 2022)
Changed paths:
M clang/lib/Sema/SemaChecking.cpp
M clang/test/Sema/unbounded-array-bounds.c
Log Message:
-----------
[Sema] Don't check bounds for function pointer
Currently, clang crashes with i386 target on the following code:
```
void f() {
f + 0xdead000000000000UL;
}
```
This problem is similar to the problem fixed in D104424, but that fix can't handle function pointer case, because `getTypeSizeInCharsIfKnown()` says that size is known and equal to 0 for function type.
This patch prevents bounds checking for function pointer, thus fixes the crash.
Fixes https://github.com/llvm/llvm-project/issues/50463
Reviewed By: erichkeane
Differential Revision: https://reviews.llvm.org/D122748
More information about the All-commits
mailing list