[all-commits] [llvm/llvm-project] 710749: [clang][Interp] Optionally cast comparison result ...

Timm Bäder via All-commits all-commits at lists.llvm.org
Thu Jun 1 01:36:58 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 710749f78695b0e00026e5ff7c9f94e08e7b482a
      https://github.com/llvm/llvm-project/commit/710749f78695b0e00026e5ff7c9f94e08e7b482a
  Author: Timm Bäder <tbaeder at redhat.com>
  Date:   2023-06-01 (Thu, 01 Jun 2023)

  Changed paths:
    M clang/lib/AST/Interp/ByteCodeExprGen.cpp
    A clang/test/AST/Interp/c.c

  Log Message:
  -----------
  [clang][Interp] Optionally cast comparison result to non-bool

Our comparison opcodes always produce a Boolean value and push it on the
stack. However, the result of such a comparison in C is int, so the
later code expects an integer value on the stack.

Work around this problem by casting the boolean value to int in those
cases. This is not ideal for C however. The comparison is usually
wrapped in a IntegerToBool cast anyway.

Differential Revision: https://reviews.llvm.org/D149645




More information about the All-commits mailing list