diff options
author | Guillaume Belz <gbdivers.spam@gmail.com> | 2024-07-11 20:53:32 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-07-12 11:53:32 +0800 |
commit | 9818ba29b91479e8f484455f36ca9f1b9a845bd1 (patch) | |
tree | deb61edbbf8a7abfc47b70bbbfd34d58d918c84e /llvm/lib/CodeGen/MachineCSE.cpp | |
parent | 062844615db5e141da118c1ad780bf102537f40a (diff) | |
download | llvm-9818ba29b91479e8f484455f36ca9f1b9a845bd1.zip llvm-9818ba29b91479e8f484455f36ca9f1b9a845bd1.tar.gz llvm-9818ba29b91479e8f484455f36ca9f1b9a845bd1.tar.bz2 |
fix assert in AArch64Arm64ECCallLowering.cpp (#98408)
The precedence of `==` operator is superior to `?:` operator. This line
is evaluated as:
```cpp
assert((ArgTranslations.size() == F->isVarArg()) ? 5 : PassthroughArgSize);
```
I guess this is not what is wanted. This causes a warning with gcc:
```
[131/602] Building CXX object lib/Target/AArch64/CMakeFiles/LLVMAArch64CodeGen.dir/AArch64Arm64ECCallLowering.cpp.o
In file included from /usr/include/c++/11/cassert:44,
from /home/linux/dev/llvm-project/llvm/include/llvm/Support/CommandLine.h:33,
from /home/linux/dev/llvm-project/llvm/lib/Target/AArch64/AArch64Arm64ECCallLowering.cpp:31:
/home/linux/dev/llvm-project/llvm/lib/Target/AArch64/AArch64Arm64ECCallLowering.cpp: In member function ‘llvm::Function* {anonymous}::AArch64Arm64ECCallLowering::buildEntryThunk(llvm::Function*)’:
/home/linux/dev/llvm-project/llvm/lib/Target/AArch64/AArch64Arm64ECCallLowering.cpp:528:50: warning: ‘?:’ using integer constants in boolean context [-Wint-in-bool-context]
528 | assert(ArgTranslations.size() == F->isVarArg() ? 5 : PassthroughArgSize);
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
```
Add parenthesis to fix the problem.
Diffstat (limited to 'llvm/lib/CodeGen/MachineCSE.cpp')
0 files changed, 0 insertions, 0 deletions