[PATCH] D137399: [clang][Interp] Emit negated integers directly as constants

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Nov 8 10:32:42 PST 2022


aaron.ballman added a comment.

This is missing test coverage (possibly around integer promotion behavior as well).



================
Comment at: clang/lib/AST/Interp/ByteCodeExprGen.cpp:1525
+        return true;
+      APSInt V = APSInt(IL->getValue(), /*IsUnsigned=*/false);
+      return this->emitConst(-V, E);
----------------
Are you sure about `IsUnsigned`? http://eel.is/c++draft/expr.unary.op#8 reads to me like `-0ULL` will remain unsigned as a result.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D137399/new/

https://reviews.llvm.org/D137399



More information about the cfe-commits mailing list