[PATCH] D156497: [BPF] Emit UNDEF rather than constant 0

Tamir Duberstein via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Aug 13 16:21:45 PDT 2023


tamird added a comment.

In D156497#4583459 <https://reviews.llvm.org/D156497#4583459>, @yonghong-song wrote:

> In D156497#4583451 <https://reviews.llvm.org/D156497#4583451>, @tamird wrote:
>
>>> With current clang, could you show me the error message with 'constant 0' vs. 'undef'? We can then decide to pick the one which is more user friendly.
>>
>> You're referring to verifier errors, right? With "constant 0" there is no verifier error - the program will just do the wrong thing (not what the programmer intended). I don't have the "undef" verifier error on hand, I can get that to you tomorrow.
>
> Not about verifier errors but errors at compilation time. The compilation should fail in two instances in this patch.

We must be misunderstanding each other. This patch doesn't change the error messages presented to the user at compilation time.

The purpose of the tests in this patch are to show how it is trivially easy to incorrectly use the LLVM C API such that diagnostics "errors" do not halt compilation.

The purpose of the non-test changes in this patch are to cause the resulting program to fail to verify. Before this patch the resulting program would appear to be valid, but violate the user's intent at runtime.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D156497



More information about the llvm-commits mailing list