[PATCH] D86892: Improve error handling for SmallVector programming errors.

Mehdi AMINI via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 31 15:22:26 PDT 2020


mehdi_amini added a comment.

In D86892#2248235 <https://reviews.llvm.org/D86892#2248235>, @GMNGeoffrey wrote:

> In D86892#2248125 <https://reviews.llvm.org/D86892#2248125>, @mehdi_amini wrote:
>
>>> I disagree. report_bad_alloc_error reports an OOM, which this is not. There is no amount of system memory that would make this not an error.
>>
>> What would `new` do?
>
> What's the question exactly?

Would `new char[std::numeric_limit<uint64_t>::max()];` issue an OOM exception? (The `There is no amount of system memory that would make this not an error` applies equally well here).

I guess a more accurate comparison would be what would `std::vector<int> vec; vec.resize(-1);` do?  (throw `std::length_error` is the answer)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D86892



More information about the llvm-commits mailing list