[all-commits] [llvm/llvm-project] 9818ba: fix assert in AArch64Arm64ECCallLowering.cpp (#98408)

Guillaume Belz via All-commits all-commits at lists.llvm.org
Thu Jul 11 20:53:54 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 9818ba29b91479e8f484455f36ca9f1b9a845bd1
      https://github.com/llvm/llvm-project/commit/9818ba29b91479e8f484455f36ca9f1b9a845bd1
  Author: Guillaume Belz <gbdivers.spam at gmail.com>
  Date:   2024-07-12 (Fri, 12 Jul 2024)

  Changed paths:
    M llvm/lib/Target/AArch64/AArch64Arm64ECCallLowering.cpp

  Log Message:
  -----------
  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.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list